Compare commits

...

58 Commits

Author SHA1 Message Date
xianny
f394d7dba9 Publish
- @0x/contracts-asset-proxy@2.2.5
 - @0x/contracts-coordinator@2.0.10
 - @0x/contracts-dev-utils@0.0.7
 - @0x/contracts-erc1155@1.1.12
 - @0x/contracts-erc20@2.2.11
 - @0x/contracts-erc721@2.1.12
 - @0x/contracts-exchange-forwarder@3.0.9
 - @0x/contracts-exchange-libs@3.0.5
 - @0x/contracts-exchange@2.1.11
 - @0x/contracts-extensions@4.0.5
 - @0x/contracts-multisig@3.1.11
 - @0x/contracts-test-utils@3.1.13
 - @0x/contracts-utils@3.2.1
 - 0x.js@6.0.15
 - @0x/abi-gen-templates@2.4.1
 - @0x/abi-gen-wrappers@5.2.0
 - @0x/abi-gen@4.1.0
 - @0x/assert@2.1.3
 - @0x/asset-buyer@6.1.11
 - @0x/asset-swapper@1.0.1
 - @0x/base-contract@5.3.1
 - @0x/connect@5.0.16
 - @0x/contract-addresses@3.0.3
 - @0x/contract-artifacts@2.0.4
 - @0x/contract-wrappers@11.0.0
 - @0x/contracts-gen@1.0.13
 - @0x/dev-utils@2.3.0
 - @0x/fill-scenarios@3.0.16
 - @0x/instant@1.0.28
 - @0x/json-schemas@3.1.13
 - @0x/migrations@4.2.0
 - @0x/monorepo-scripts@1.0.34
 - @0x/order-utils@8.2.5
 - @0x/order-watcher@4.0.17
 - @0x/python-contract-wrappers@1.0.3
 - @0x/sol-compiler@3.1.12
 - @0x/sol-coverage@3.0.9
 - @0x/sol-doc@2.0.16
 - @0x/sol-profiler@3.1.11
 - @0x/sol-trace@2.0.17
 - @0x/sol-tracing-utils@6.0.16
 - @0x/sra-spec@2.0.14
 - @0x/subproviders@5.0.1
 - @0x/testnet-faucets@1.0.84
 - @0x/utils@4.5.0
 - @0x/web3-wrapper@6.0.10
 - @0x/website@0.0.87
2019-08-08 13:58:46 -07:00
xianny
ca595cd8cf Updated CHANGELOGS 2019-08-08 13:58:30 -07:00
F. Eugene Aumson
ec807120c3 Migrate to Web3.py v5 (#2038)
* Install Py packages in dep. order, not in parallel

Install Python packages in dependency order, not in parallel.

* sra_client.py: Add `./setup.py clean`

* Fix python package dependency ordering...

...and include a script to produce the proper ordering.

* sra_client.py: reformat whitespace in doctest

* contract_wrappers.py: don't auto-import wrappers

This was discovered while minimizing CircleCI steps to dianose a problem
with running the Launch Kit Backend in CircleCI.

These classes should be imported via the
zero_ex.contract_wrappers.exchange and
zero_ex.contract_wrappers.erc20_token modules, respectively.  We
permitted importing them from just zero_ex.contract_wrappers back when
they were the only wrappers we had, but now that we have so many
different contracts being wrapped, this is just another list to keep
manually updated (which, obviously is error prone, since it slipped
through the cracks already), so it's better to just not support this
type of import.

* abi-gen/Py: doc contract method attributes

Without this, generated documentation was not including the class
members that represent the contract methods, rendering the usage
unclear.

* sra_client.py: disable tests in CI

* abi-gen/Py: strip repeated spaces from devdoc

* contract_wrappers.py: gen docs for all wrappers...

...except for the dummy tokens.

* sra_client.py/test: change launch kit docker image

Previously these teses were using 0xorg/launch-kit-ci, but that was a
one-off thing created just for CI, back before there was a regularly
maintained docker image of Launch Kit.

Changed to use 0xorg/launch-kit-backend since it's regularly
maintained/updated.

Because the -backend image is using a different Linux distribution
(Alpine), the commands used to wait for ganache startup also had to
change.

The tag used, 74bcc39, is provisional due to the pending Issue at
https://github.com/0xProject/0x-launch-kit-backend/issues/73 .  When
that issue is resolved, the tag suffix on the imag name should be
removed.

* Migrate from Web3.py 4.x to 5.x

* sra_client.py: checksum address in doctest

Due to problem with launch-kit-backend, documented at
https://github.com/0xProject/0x-launch-kit-backend/issues/73 ,
we need to checksum the makerAddress, in the order retrieved from the
relayer, before filling it, otherwise Web3.py gives this error:

InvalidAddress('Web3.py only accepts checksum addresses. The software
that gave you this non-checksum address should be considered unsafe,
please file it as a bug on their platform. Try using an ENS name
instead. Or, if you must accept lower safety, use
Web3.toChecksumAddress(lower_case_address).',
'0x5409ed021d9299bf6814279a6a1411a7e866a631')

* Update CHANGELOGs

* sra_client.py: make CHANGELOG be REVESE chrono.

Formerly CHANGELOG was in chronological order.  Now it's in reverse
chronological order.

* abi-gen/Py: fix missing space in sanitized devdoc
2019-08-08 14:53:59 -04:00
xianny
a5654debeb pin contract-wrappers to earlier version 2019-08-08 11:48:47 -07:00
xianny
0869c0d8b0 Revert "Updated CHANGELOGS"
This reverts commit b456c3f953.
2019-08-08 11:47:30 -07:00
xianny
b456c3f953 Updated CHANGELOGS 2019-08-08 11:41:38 -07:00
xianny
8297d68166 fix contract-wrappers version 2019-08-08 10:49:03 -07:00
xianny
18ce6797e0 Revert failed publish 2019-08-08 10:02:32 -07:00
xianny
c1009d440e Publish
- @0x/contracts-asset-proxy@2.2.5
 - @0x/contracts-coordinator@2.0.10
 - @0x/contracts-dev-utils@0.0.7
 - @0x/contracts-erc1155@1.1.12
 - @0x/contracts-erc20@2.2.11
 - @0x/contracts-erc721@2.1.12
 - @0x/contracts-exchange-forwarder@3.0.9
 - @0x/contracts-exchange-libs@3.0.5
 - @0x/contracts-exchange@2.1.11
 - @0x/contracts-extensions@4.0.5
 - @0x/contracts-multisig@3.1.11
 - @0x/contracts-test-utils@3.1.13
 - @0x/contracts-utils@3.2.1
 - 0x.js@6.0.15
 - @0x/abi-gen-templates@2.4.1
 - @0x/abi-gen-wrappers@5.2.0
 - @0x/abi-gen@4.1.0
 - @0x/assert@2.1.3
 - @0x/asset-buyer@6.1.11
 - @0x/asset-swapper@1.0.1
 - @0x/base-contract@5.3.1
 - @0x/connect@5.0.16
 - @0x/contract-addresses@3.0.3
 - @0x/contract-artifacts@2.0.4
 - @0x/contract-wrappers@11.0.0
 - @0x/contracts-gen@1.0.13
 - @0x/dev-utils@2.3.0
 - @0x/fill-scenarios@3.0.16
 - @0x/instant@1.0.28
 - @0x/json-schemas@3.1.13
 - @0x/migrations@4.2.0
 - @0x/monorepo-scripts@1.0.34
 - @0x/order-utils@8.2.5
 - @0x/order-watcher@4.0.17
 - @0x/python-contract-wrappers@1.0.3
 - @0x/sol-compiler@3.1.12
 - @0x/sol-coverage@3.0.9
 - @0x/sol-doc@2.0.16
 - @0x/sol-profiler@3.1.11
 - @0x/sol-trace@2.0.17
 - @0x/sol-tracing-utils@6.0.16
 - @0x/sra-spec@2.0.14
 - @0x/subproviders@5.0.1
 - @0x/testnet-faucets@1.0.84
 - @0x/utils@4.5.0
 - @0x/web3-wrapper@6.0.10
 - @0x/website@0.0.87
2019-08-08 09:29:23 -07:00
xianny
89ee6fe6db Updated CHANGELOGS 2019-08-08 09:29:08 -07:00
Fabio Berger
38a12475bc Update yarn.lock 2019-08-08 08:12:12 -07:00
Fabio Berger
9a800264a2 Update Lerna and fix private package issue 2019-08-08 08:04:58 -07:00
Xianny
8ce390be3c switch @0x/contract-wrappers to generated wrappers (#2037)
* switch @0x/contract-wrappers to generated wrappers

- remove TransactionEncoder
- move TokenUtils to @0x/dev-utils
- detailed changes in #2040
2019-08-08 07:29:30 -07:00
F. Eugene Aumson
5ac7ff7084 Generate wrappers for all contracts (#2010)
* abi-gen/Py: fix return type for multi-val returns

Methods that return multiple values were broken in two ways.  One: a
spurious newline was being injected between the return type and the
colon ending the Python method prototype.  Two: the return type was
being generated as just `[TypeA, TypeB]`, whereas it should be
`Tuple[TypeA, TypeB]`.

* abi-gen/Py: fix support for arrays of structs

* abi-gen/Py: FAILING test case nested unrefd struct

When a struct contains another struct, and the inner struct is not
directly referenced by any method interface, wrapper generation is
failing to render a class to represent the inner struct.

This won't fail in CI because at this time CI doesn't run any native
Python tooling to analyze the generated code.  Running mypy locally on
the files in this commit produces the following output:

test-cli/output/python/abi_gen_dummy/__init__.py:76: error: Name 'Tuple0x246f9407' is not defined

This problem affects the generation of wrappers for the DutchAuction
contract.

* abi-gen/Py: fix nested unref'd struct failure

* abi-gen/Py: introduce newlines to quiet linter

When generating contracts with long names (eg
CoordinatorRegistryValidator), the `black` reformatter was introducing
these newlines for us, and it was moving the `# type: ignore` comment in
there such that it no longer was on the line it needed to be on.
Introducing these newlines manually (instead of letting black inject
them) allows the linter directive to stay where it needs to be.

* abi-gen/Py: declare tuples in dependency order

* abi-gen/Py: fix support for overloaded methods

* contract_wrappers.py: pylint: permit 2-char args

By default pylint says that 2 characters is too short for an argument
name, but we have some contract methods with 2-character argument names
(eg `to` in `AssetProxyOwner.getTransactionIds()`), so we want to permit
them.

* contract_wrappers.py: include all contracts

* Update CHANGELOGs

* abi-gen: rename variable

* abi-gen: refine comments

* abi-gen/Py: reword tuple class docstring
2019-08-07 12:44:16 -04:00
Jacob Evans
e682b82ca8 Merge pull request #2021 from 0xProject/feat/1155-staticCall-proxies
1155 static call proxies
2019-08-07 09:34:25 +10:00
Xianny
7cd1fd0aaa Add devdocs to generated contract wrappers (#2013)
* first pass at including doc comments

* incorporate suggestions for method comments; add devdoc to dummy contract

* better formatting and persist generated docs as circleci build artifacts

* store artifacts properly

* hanging indent for method params
2019-08-06 14:24:08 -07:00
Jacob Evans
8cd99c5a40 Update Changelog 2019-08-06 17:26:49 +10:00
Jacob Evans
ad83312009 Update @0x/coordinator-server dependency 2019-08-06 09:50:10 +10:00
Jacob Evans
9e3b1fe333 Update to latest Coordinator Config 2019-08-06 09:45:41 +10:00
Jacob Evans
c3f42995f9 Update python addresses 2019-08-06 09:45:41 +10:00
Amir Bandeali
3d3a02c892 Add mainnet StaticCall and ERC1155Proxy addresses 2019-08-06 09:45:41 +10:00
Amir Bandeali
06bec227ad Add authorizedAddresses length check to MAP config tests 2019-08-06 09:45:40 +10:00
Amir Bandeali
5d7803323c Add script that tests deployed contract configs 2019-08-06 09:45:40 +10:00
Jacob Evans
4303f9a025 Add Ganache addresses to contract-addresses 2019-08-06 09:45:40 +10:00
Jacob Evans
fe4c5434fa Update migration 2019-08-06 09:45:40 +10:00
Amir Bandeali
9325bb70c5 Add testnet addresses 2019-08-06 09:45:39 +10:00
Amir Bandeali
b164557165 Add ERC1155Proxy and StaticCallProxy to build 2019-08-06 09:45:39 +10:00
Amir Bandeali
424f984ea8 Add ERC1155Proxy and StaticCallProxy artifacts 2019-08-06 09:45:39 +10:00
David Sun
78c704e3d1 Merge pull request #2032 from 0xProject/feature/asset-swapper/update-comments-info
Update comments for asset-swapper
2019-08-02 13:47:48 -07:00
Xianny
50f1a8fbd8 Add test for struct output in abi-gen (typescript) (#2028)
* add TS test for non-empty struct output
2019-08-02 13:34:19 -07:00
David Sun
0f90b7b5da Update comments for asset-swapper 2019-08-02 13:32:45 -07:00
David Sun
bec4384a5d Merge pull request #2030 from 0xProject/feature/website/change-credit-forms
Change modal contact form
2019-08-02 12:41:29 -07:00
David Sun
f361efae5a change modal contact form 2019-08-02 12:33:34 -07:00
Greg Hysz
76ca2116ab Merge pull request #2018 from 0xProject/feature/ContractWrappers/abiEncodeDecodeTxData
Decode Calldata + Return Values in Contract Wrappers
2019-08-02 09:51:01 +02:00
Greg Hysen
33d8646dc5 added start/end test comments to AbiGenDummy for consistency 2019-08-02 09:27:05 +02:00
F. Eugene Aumson
3cb5190bc6 Relax gas estimate expectation in Python doctest 2019-08-01 19:12:08 -04:00
Francesco Agosti
5bba06bef8 Merge pull request #2026 from 0xProject/feature/what_is_0x_video_embed
Add sandwich video to landing page
2019-08-01 14:27:30 -07:00
fragosti
dd3f672a35 Make video wider 2019-08-01 13:56:19 -07:00
fragosti
25ef3b8445 Merge branch 'development' of https://github.com/0xProject/0x-monorepo into feature/what_is_0x_video_embed 2019-08-01 13:43:33 -07:00
Greg Hysen
7eb2d290d8 Ran prettier 2019-08-01 20:25:19 +02:00
Greg Hysen
678762910b Fixed typo in callAsync.handlebars and updated expected output in abi-gen 2019-08-01 19:07:12 +02:00
Greg Hysen
da28a542c7 Added abi encoder test when bad selector is passed to method decoding 2019-08-01 19:07:12 +02:00
Greg Hysen
92602d33ad removed unnecessary fallback function from abi-gen tests 2019-08-01 19:07:12 +02:00
Greg Hysen
03f04f4bb3 Moved contract wrapper abi tests into abi-gen package 2019-08-01 19:07:12 +02:00
Greg Hysen
0d4dd5ff0d Appeased the linter 2019-08-01 19:05:22 +02:00
Greg Hysen
884864cc58 updated changelogs 2019-08-01 19:05:22 +02:00
Greg Hysen
7c199d83be updated expected output for abi-gen cli tests 2019-08-01 19:00:50 +02:00
Greg Hysen
5b4c29c4bb updated abi-gen-wrappers 2019-08-01 19:00:50 +02:00
Greg Hysen
f97ee80955 Added tests for strict decoding of method arguments 2019-08-01 19:00:50 +02:00
Greg Hysen
547322ae63 Do not allow allow reading beyond calldata 2019-08-01 19:00:50 +02:00
Greg Hysen
db74db622e Added getABIDecodedTransactionData and getABIDecodedReturnData to contract wrappers + test cases 2019-08-01 19:00:50 +02:00
F. Eugene Aumson
57318c0041 Python nested wrapper methods & estimate_gas (#1996)
* git rm unnecessary .gitkeep file

* After all Pytest runs, show short test summary

* abi-gen/Py: facilitate inlining of parameter lists

Effectively, stopped new-lines from being introduced by calls to the
`params` and `typed_params` partials.

* abi-gen: simple Py wrapper test for local dev'ment

* abi-gen/Py: stop gen'ing ValidatorBase

* abi-gen/Py: declare abi() wrapper method in Base

* abi-gen/Py: methods as classes to ease call/sendTx

Represent methods as classes in order to faciliate access to a method's
different operations (call, send_transaction, etc).

* contract_wrappers.py: make Base methods public

Changed some methods on BaseContractWrapper to be public.

* contract_wrappers.py: remove unused method

* contract_wrappers.py: extract method

* abi-gen/Py: inline method

* contract_wrappers.py: fix bug in call()

We were passing transaction parameters through to sendTransaction()
invocations, but not to call() invocations.

* abi-gen/Py: remove `view_only` param to call/tx

Formerly, in the BaseContractWrapper, there was just one function used
for both eth_call and eth_sendTransaction, and you would distinguish
between the two by specifying `view_only=True` when you wanted a call.

This commit defines a method dedicated to executing an eth_call, and
leaves the old method behind, with the `view_only` param removed, to be
used for eth_sendTransaction.

* abi-gen/Py: rename method

* contract_wrappers/Py: simplify web3 func handling

Pass web3 function instance into generated wrapper method class
constructor, rather than having that class obtain it upon each method
call.

Really this is just an elimination of a call to
BaseContractWrapper.contract_instance(), which will be removed
completely in a shortly-upcoming commit.

* contract_wrappers.py: inline method

Inline and remove method BaseContractWrapper.contract_instance().

* contract_wrappers.py: pass Validator to *Method

Pass a ValidatorBase instance into construction of the contract method
classes, *Method, to eliminate another dependency on the containing
contract object, which will be eliminated completely in a
shortly-upcoming commit.

* abi-gen/Py: BaseContractWrapper -> ContractMethod

Change the fundamental thing-to-be-wrapped from the contract to the
method.  Since the named method classes were introduced (in a previous
commit), and since the operations contained within the Base are
predominantly focused on supporting method calls more than anything
else, it makes more intuitive sense to provide a base for the methods
than for the contract.

With this change, the method classes no longer require a contract object
to be passed to their constructors.  The contract members that the
methods were utilizing are now passed directly to the method
constructor.

* contract_wrappers.py: rename module to bases...

...from _base_contract_wrapper.  The old name hasn't made sense since
ValidatorBase was moved into that module, and definitely doesn't make
sense now that the fundamental thing-to-be-wrapped has changed from the
contract to the method.  Also renamed to make it public (removed the
leading underscore) since we're generating code that will depend on it.

* abi-gen/Py: clarify call/sendTx docstrings

* abi-gen/Py: adjust whitespace

* contract_wrappers.py: inline method

* abi-gen/Py: rename class ValidatorBase...

...to just Validator.  It's in the "bases" module, which provides the
context needed in order to know it's a base class

* python-packages: fix silent failures of ./parallel

* contract_wrappers.py: remove private_key support

Having this present was overcomplicating interfaces.  And it was
untested (and not readily working when testing was attempted).  And it
only provided a thin layer of convenience, which a client could easily
code up themselves.

* contract_wrappers.py: inline method

* contract_wrappers.py: rm unused member variables

* contract_wrappers.py: rm unnecessary instance var

* abi-gen/Py: add estimate_gas to gen'd methods

* update CHANGELOG.json
2019-08-01 12:47:52 -04:00
fabioberger
4eb0767834 Update deps in private packages 2019-08-01 14:56:23 +02:00
fragosti
92bb7808ce Remove react-modal-video from website types 2019-07-31 17:50:21 -07:00
fragosti
abfe7d1613 Merge branch 'development' of https://github.com/0xProject/0x-monorepo into feature/what_is_0x_video_embed 2019-07-31 17:13:58 -07:00
fragosti
6c72239365 Remove react-modal-video as a dep and use the sass directly 2019-07-31 17:06:10 -07:00
fragosti
8001daad8c Fix linting errors 2019-07-31 16:40:39 -07:00
fragosti
73a38ab4f4 Add sandwich video to landing page 2019-07-31 15:15:55 -07:00
338 changed files with 52890 additions and 9196 deletions

View File

@@ -37,6 +37,8 @@ jobs:
path: ~/repo/packages/python-contract-wrappers/generated
- store_artifacts:
path: ~/repo/packages/abi-gen/test-cli/output
- store_artifacts:
path: ~/repo/packages/abi-gen-wrappers/generated_docs
build-website:
resource_class: medium+
docker:
@@ -180,12 +182,13 @@ jobs:
docker:
- image: circleci/python
- image: 0xorg/ganache-cli:2.2.2
- image: 0xorg/launch-kit-ci
- image: 0xorg/launch-kit-backend:74bcc39
environment:
RPC_URL: http://localhost:8545
NETWORK_ID: 50
WHITELIST_ALL_TOKENS: True
command: bash -c "until curl -sfd'{\"method\":\"net_listening\"}' http://localhost:8545 | grep true; do continue; done; forever ts/lib/index.js"
command: |
sh -c "until printf 'POST /\r\nContent-Length: 26\r\n\r\n{\"method\":\"net_listening\"}' | nc localhost 8545 | grep true; do continue; done; node_modules/.bin/forever ts/lib/index.js"
steps:
- checkout
- run: sudo chown -R circleci:circleci /usr/local/bin
@@ -208,7 +211,7 @@ jobs:
- run:
command: |
cd python-packages
./parallel coverage run setup.py test
./parallel_without_sra_client coverage run setup.py test
./build_docs
- save_cache:
key: coverage-python-contract-addresses-{{ .Environment.CIRCLE_SHA1 }}

1
.gitattributes vendored
View File

@@ -4,4 +4,5 @@
*.svg linguist-generated=true
packages/contract-artifacts/artifacts/*json linguist-generated=true
packages/abi-gen-wrappers/src/generated-wrappers/*.ts linguist-generated=true
packages/contract-wrappers/src/generated-wrappers/*.ts linguist-generated=true

18
.gitignore vendored
View File

@@ -114,6 +114,24 @@ contracts/exchange-forwarder/generated-wrappers/
contracts/dev-utils/generated-wrappers/
python-packages/contract_wrappers/src/zero_ex/contract_wrappers/erc20_token/__init__.py
python-packages/contract_wrappers/src/zero_ex/contract_wrappers/exchange/__init__.py
python-packages/contract_wrappers/src/zero_ex/contract_wrappers/asset_proxy_owner/__init__.py
python-packages/contract_wrappers/src/zero_ex/contract_wrappers/coordinator/__init__.py
python-packages/contract_wrappers/src/zero_ex/contract_wrappers/coordinator_registry/__init__.py
python-packages/contract_wrappers/src/zero_ex/contract_wrappers/dummy_erc20_token/__init__.py
python-packages/contract_wrappers/src/zero_ex/contract_wrappers/dummy_erc721_token/__init__.py
python-packages/contract_wrappers/src/zero_ex/contract_wrappers/dutch_auction/__init__.py
python-packages/contract_wrappers/src/zero_ex/contract_wrappers/erc20_proxy/__init__.py
python-packages/contract_wrappers/src/zero_ex/contract_wrappers/erc721_proxy/__init__.py
python-packages/contract_wrappers/src/zero_ex/contract_wrappers/erc721_token/__init__.py
python-packages/contract_wrappers/src/zero_ex/contract_wrappers/eth_balance_checker/__init__.py
python-packages/contract_wrappers/src/zero_ex/contract_wrappers/forwarder/__init__.py
python-packages/contract_wrappers/src/zero_ex/contract_wrappers/i_asset_proxy/__init__.py
python-packages/contract_wrappers/src/zero_ex/contract_wrappers/i_validator/__init__.py
python-packages/contract_wrappers/src/zero_ex/contract_wrappers/i_wallet/__init__.py
python-packages/contract_wrappers/src/zero_ex/contract_wrappers/multi_asset_proxy/__init__.py
python-packages/contract_wrappers/src/zero_ex/contract_wrappers/order_validator/__init__.py
python-packages/contract_wrappers/src/zero_ex/contract_wrappers/weth9/__init__.py
python-packages/contract_wrappers/src/zero_ex/contract_wrappers/zrx_token/__init__.py
# cli test output
packages/abi-gen/test-cli/output

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1565296576,
"version": "2.2.5",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "2.2.4",
"changes": [

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v2.2.5 - _August 8, 2019_
* Dependencies updated
## v2.2.4 - _July 31, 2019_
* Updated calls to <contract wrapper>.deployFrom0xArtifactAsync to include artifact dependencies. (#1995)

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-asset-proxy",
"version": "2.2.4",
"version": "2.2.5",
"engines": {
"node": ">=6.12"
},
@@ -47,11 +47,11 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/protocol/README.md",
"devDependencies": {
"@0x/abi-gen": "^3.1.2",
"@0x/contracts-gen": "^1.0.12",
"@0x/contracts-test-utils": "^3.1.12",
"@0x/dev-utils": "^2.2.6",
"@0x/sol-compiler": "^3.1.11",
"@0x/abi-gen": "^4.1.0",
"@0x/contracts-gen": "^1.0.13",
"@0x/contracts-test-utils": "^3.1.13",
"@0x/dev-utils": "^2.3.0",
"@0x/sol-compiler": "^3.1.12",
"@0x/tslint-config": "^3.0.1",
"@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7",
@@ -69,16 +69,16 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^5.3.0",
"@0x/contracts-erc1155": "^1.1.11",
"@0x/contracts-erc20": "^2.2.10",
"@0x/contracts-erc721": "^2.1.11",
"@0x/contracts-utils": "^3.2.0",
"@0x/order-utils": "^8.2.4",
"@0x/base-contract": "^5.3.1",
"@0x/contracts-erc1155": "^1.1.12",
"@0x/contracts-erc20": "^2.2.11",
"@0x/contracts-erc721": "^2.1.12",
"@0x/contracts-utils": "^3.2.1",
"@0x/order-utils": "^8.2.5",
"@0x/types": "^2.4.1",
"@0x/typescript-typings": "^4.2.4",
"@0x/utils": "^4.4.2",
"@0x/web3-wrapper": "^6.0.9",
"@0x/utils": "^4.5.0",
"@0x/web3-wrapper": "^6.0.10",
"ethereum-types": "^2.1.4",
"ethereumjs-util": "^5.1.1",
"lodash": "^4.17.11"

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1565296576,
"version": "2.0.10",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "2.0.9",
"changes": [

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v2.0.10 - _August 8, 2019_
* Dependencies updated
## v2.0.9 - _July 31, 2019_
* Updated calls to <contract wrapper>.deployFrom0xArtifactAsync to include artifact dependencies. (#1995)

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-coordinator",
"version": "2.0.9",
"version": "2.0.10",
"engines": {
"node": ">=6.12"
},
@@ -47,11 +47,11 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/extensions/README.md",
"devDependencies": {
"@0x/abi-gen": "^3.1.2",
"@0x/contracts-gen": "^1.0.12",
"@0x/contracts-test-utils": "^3.1.12",
"@0x/dev-utils": "^2.2.6",
"@0x/sol-compiler": "^3.1.11",
"@0x/abi-gen": "^4.1.0",
"@0x/contracts-gen": "^1.0.13",
"@0x/contracts-test-utils": "^3.1.13",
"@0x/dev-utils": "^2.3.0",
"@0x/sol-compiler": "^3.1.12",
"@0x/tslint-config": "^3.0.1",
"@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7",
@@ -69,17 +69,17 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^5.3.0",
"@0x/contracts-asset-proxy": "^2.2.4",
"@0x/contracts-erc20": "^2.2.10",
"@0x/contracts-exchange": "^2.1.10",
"@0x/contracts-exchange-libs": "^3.0.4",
"@0x/contracts-utils": "^3.2.0",
"@0x/order-utils": "^8.2.4",
"@0x/base-contract": "^5.3.1",
"@0x/contracts-asset-proxy": "^2.2.5",
"@0x/contracts-erc20": "^2.2.11",
"@0x/contracts-exchange": "^2.1.11",
"@0x/contracts-exchange-libs": "^3.0.5",
"@0x/contracts-utils": "^3.2.1",
"@0x/order-utils": "^8.2.5",
"@0x/types": "^2.4.1",
"@0x/typescript-typings": "^4.2.4",
"@0x/utils": "^4.4.2",
"@0x/web3-wrapper": "^6.0.9",
"@0x/utils": "^4.5.0",
"@0x/web3-wrapper": "^6.0.10",
"ethereum-types": "^2.1.4",
"ethereumjs-util": "^5.1.1",
"lodash": "^4.17.11"

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1565296576,
"version": "0.0.7",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1564607468,
"version": "0.0.6",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v0.0.7 - _August 8, 2019_
* Dependencies updated
## v0.0.6 - _July 31, 2019_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-dev-utils",
"version": "0.0.6",
"version": "0.0.7",
"engines": {
"node": ">=6.12"
},
@@ -47,12 +47,11 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/dev-utils/README.md",
"devDependencies": {
"@0x/abi-gen": "^3.1.2",
"@0x/contract-wrappers": "^10.1.0",
"@0x/contracts-gen": "^1.0.12",
"@0x/contracts-test-utils": "^3.1.12",
"@0x/dev-utils": "^2.2.6",
"@0x/sol-compiler": "^3.1.11",
"@0x/abi-gen": "^4.1.0",
"@0x/contracts-gen": "^1.0.13",
"@0x/contracts-test-utils": "^3.1.13",
"@0x/dev-utils": "^2.3.0",
"@0x/sol-compiler": "^3.1.12",
"@0x/tslint-config": "^3.0.1",
"@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7",
@@ -70,19 +69,19 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^5.3.0",
"@0x/contracts-asset-proxy": "^2.2.4",
"@0x/contracts-erc1155": "^1.1.11",
"@0x/contracts-erc20": "^2.2.10",
"@0x/contracts-erc721": "^2.1.11",
"@0x/contracts-exchange": "^2.1.10",
"@0x/contracts-exchange-libs": "^3.0.4",
"@0x/contracts-utils": "^3.2.0",
"@0x/order-utils": "^8.2.4",
"@0x/base-contract": "^5.3.1",
"@0x/contracts-asset-proxy": "^2.2.5",
"@0x/contracts-erc1155": "^1.1.12",
"@0x/contracts-erc20": "^2.2.11",
"@0x/contracts-erc721": "^2.1.12",
"@0x/contracts-exchange": "^2.1.11",
"@0x/contracts-exchange-libs": "^3.0.5",
"@0x/contracts-utils": "^3.2.1",
"@0x/order-utils": "^8.2.5",
"@0x/types": "^2.4.1",
"@0x/typescript-typings": "^4.2.4",
"@0x/utils": "^4.4.2",
"@0x/web3-wrapper": "^6.0.9",
"@0x/utils": "^4.5.0",
"@0x/web3-wrapper": "^6.0.10",
"ethereum-types": "^2.1.4",
"ethereumjs-util": "^5.1.1"
},

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1565296576,
"version": "1.1.12",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "1.1.11",
"changes": [

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.1.12 - _August 8, 2019_
* Dependencies updated
## v1.1.11 - _July 31, 2019_
* Updated calls to <contract wrapper>.deployFrom0xArtifactAsync to include artifact dependencies. (#1995)

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-erc1155",
"version": "1.1.11",
"version": "1.1.12",
"engines": {
"node": ">=6.12"
},
@@ -47,10 +47,10 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/tokens/README.md",
"devDependencies": {
"@0x/abi-gen": "^3.1.2",
"@0x/contracts-gen": "^1.0.12",
"@0x/dev-utils": "^2.2.6",
"@0x/sol-compiler": "^3.1.11",
"@0x/abi-gen": "^4.1.0",
"@0x/contracts-gen": "^1.0.13",
"@0x/dev-utils": "^2.3.0",
"@0x/sol-compiler": "^3.1.12",
"@0x/tslint-config": "^3.0.1",
"@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7",
@@ -68,13 +68,13 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^5.3.0",
"@0x/contracts-test-utils": "^3.1.12",
"@0x/contracts-utils": "^3.2.0",
"@0x/base-contract": "^5.3.1",
"@0x/contracts-test-utils": "^3.1.13",
"@0x/contracts-utils": "^3.2.1",
"@0x/types": "^2.4.1",
"@0x/typescript-typings": "^4.2.4",
"@0x/utils": "^4.4.2",
"@0x/web3-wrapper": "^6.0.9",
"@0x/utils": "^4.5.0",
"@0x/web3-wrapper": "^6.0.10",
"ethereum-types": "^2.1.4",
"lodash": "^4.17.11"
},

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1565296576,
"version": "2.2.11",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "2.2.10",
"changes": [

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v2.2.11 - _August 8, 2019_
* Dependencies updated
## v2.2.10 - _July 31, 2019_
* Updated calls to <contract wrapper>.deployFrom0xArtifactAsync to include artifact dependencies. (#1995)

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-erc20",
"version": "2.2.10",
"version": "2.2.11",
"engines": {
"node": ">=6.12"
},
@@ -47,11 +47,11 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/tokens/README.md",
"devDependencies": {
"@0x/abi-gen": "^3.1.2",
"@0x/contracts-gen": "^1.0.12",
"@0x/contracts-test-utils": "^3.1.12",
"@0x/dev-utils": "^2.2.6",
"@0x/sol-compiler": "^3.1.11",
"@0x/abi-gen": "^4.1.0",
"@0x/contracts-gen": "^1.0.13",
"@0x/contracts-test-utils": "^3.1.13",
"@0x/dev-utils": "^2.3.0",
"@0x/sol-compiler": "^3.1.12",
"@0x/tslint-config": "^3.0.1",
"@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7",
@@ -69,12 +69,12 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^5.3.0",
"@0x/contracts-utils": "^3.2.0",
"@0x/base-contract": "^5.3.1",
"@0x/contracts-utils": "^3.2.1",
"@0x/types": "^2.4.1",
"@0x/typescript-typings": "^4.2.4",
"@0x/utils": "^4.4.2",
"@0x/web3-wrapper": "^6.0.9",
"@0x/utils": "^4.5.0",
"@0x/web3-wrapper": "^6.0.10",
"ethereum-types": "^2.1.4",
"lodash": "^4.17.11"
},

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1565296576,
"version": "2.1.12",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "2.1.11",
"changes": [

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v2.1.12 - _August 8, 2019_
* Dependencies updated
## v2.1.11 - _July 31, 2019_
* Updated calls to <contract wrapper>.deployFrom0xArtifactAsync to include artifact dependencies. (#1995)

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-erc721",
"version": "2.1.11",
"version": "2.1.12",
"engines": {
"node": ">=6.12"
},
@@ -47,11 +47,11 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/tokens/README.md",
"devDependencies": {
"@0x/abi-gen": "^3.1.2",
"@0x/contracts-gen": "^1.0.12",
"@0x/contracts-test-utils": "^3.1.12",
"@0x/dev-utils": "^2.2.6",
"@0x/sol-compiler": "^3.1.11",
"@0x/abi-gen": "^4.1.0",
"@0x/contracts-gen": "^1.0.13",
"@0x/contracts-test-utils": "^3.1.13",
"@0x/dev-utils": "^2.3.0",
"@0x/sol-compiler": "^3.1.12",
"@0x/tslint-config": "^3.0.1",
"@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7",
@@ -69,12 +69,12 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^5.3.0",
"@0x/contracts-utils": "^3.2.0",
"@0x/base-contract": "^5.3.1",
"@0x/contracts-utils": "^3.2.1",
"@0x/types": "^2.4.1",
"@0x/typescript-typings": "^4.2.4",
"@0x/utils": "^4.4.2",
"@0x/web3-wrapper": "^6.0.9",
"@0x/utils": "^4.5.0",
"@0x/web3-wrapper": "^6.0.10",
"ethereum-types": "^2.1.4",
"lodash": "^4.17.11"
},

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1565296576,
"version": "3.0.9",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "3.0.8",
"changes": [

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v3.0.9 - _August 8, 2019_
* Dependencies updated
## v3.0.8 - _July 31, 2019_
* Updated calls to <contract wrapper>.deployFrom0xArtifactAsync to include artifact dependencies. (#1995)

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-exchange-forwarder",
"version": "3.0.8",
"version": "3.0.9",
"engines": {
"node": ">=6.12"
},
@@ -46,12 +46,11 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/extensions/README.md",
"devDependencies": {
"@0x/abi-gen": "^3.1.2",
"@0x/contract-wrappers": "^10.1.0",
"@0x/contracts-gen": "^1.0.12",
"@0x/contracts-test-utils": "^3.1.12",
"@0x/dev-utils": "^2.2.6",
"@0x/sol-compiler": "^3.1.11",
"@0x/abi-gen": "^4.1.0",
"@0x/contracts-gen": "^1.0.13",
"@0x/contracts-test-utils": "^3.1.13",
"@0x/dev-utils": "^2.3.0",
"@0x/sol-compiler": "^3.1.12",
"@0x/tslint-config": "^3.0.1",
"@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7",
@@ -69,18 +68,18 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^5.3.0",
"@0x/contracts-asset-proxy": "^2.2.4",
"@0x/contracts-erc20": "^2.2.10",
"@0x/contracts-erc721": "^2.1.11",
"@0x/contracts-exchange": "^2.1.10",
"@0x/contracts-exchange-libs": "^3.0.4",
"@0x/contracts-utils": "^3.2.0",
"@0x/order-utils": "^8.2.4",
"@0x/base-contract": "^5.3.1",
"@0x/contracts-asset-proxy": "^2.2.5",
"@0x/contracts-erc20": "^2.2.11",
"@0x/contracts-erc721": "^2.1.12",
"@0x/contracts-exchange": "^2.1.11",
"@0x/contracts-exchange-libs": "^3.0.5",
"@0x/contracts-utils": "^3.2.1",
"@0x/order-utils": "^8.2.5",
"@0x/types": "^2.4.1",
"@0x/typescript-typings": "^4.2.4",
"@0x/utils": "^4.4.2",
"@0x/web3-wrapper": "^6.0.9",
"@0x/utils": "^4.5.0",
"@0x/web3-wrapper": "^6.0.10",
"ethereum-types": "^2.1.4",
"lodash": "^4.17.11"
},

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1565296576,
"version": "3.0.5",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "3.0.4",
"changes": [

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v3.0.5 - _August 8, 2019_
* Dependencies updated
## v3.0.4 - _July 31, 2019_
* Updated calls to <contract wrapper>.deployFrom0xArtifactAsync to include artifact dependencies. (#1995)

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-exchange-libs",
"version": "3.0.4",
"version": "3.0.5",
"engines": {
"node": ">=6.12"
},
@@ -47,11 +47,11 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/libs/README.md",
"devDependencies": {
"@0x/abi-gen": "^3.1.2",
"@0x/contracts-gen": "^1.0.12",
"@0x/contracts-test-utils": "^3.1.12",
"@0x/dev-utils": "^2.2.6",
"@0x/sol-compiler": "^3.1.11",
"@0x/abi-gen": "^4.1.0",
"@0x/contracts-gen": "^1.0.13",
"@0x/contracts-test-utils": "^3.1.13",
"@0x/dev-utils": "^2.3.0",
"@0x/sol-compiler": "^3.1.12",
"@0x/tslint-config": "^3.0.1",
"@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7",
@@ -69,13 +69,13 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^5.3.0",
"@0x/contracts-utils": "^3.2.0",
"@0x/order-utils": "^8.2.4",
"@0x/base-contract": "^5.3.1",
"@0x/contracts-utils": "^3.2.1",
"@0x/order-utils": "^8.2.5",
"@0x/types": "^2.4.1",
"@0x/typescript-typings": "^4.2.4",
"@0x/utils": "^4.4.2",
"@0x/web3-wrapper": "^6.0.9",
"@0x/utils": "^4.5.0",
"@0x/web3-wrapper": "^6.0.10",
"ethereum-types": "^2.1.4",
"lodash": "^4.17.11"
},

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1565296576,
"version": "2.1.11",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "2.1.10",
"changes": [

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v2.1.11 - _August 8, 2019_
* Dependencies updated
## v2.1.10 - _July 31, 2019_
* Updated calls to <contract wrapper>.deployFrom0xArtifactAsync to include artifact dependencies. (#1995)

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-exchange",
"version": "2.1.10",
"version": "2.1.11",
"engines": {
"node": ">=6.12"
},
@@ -47,11 +47,11 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/protocol/README.md",
"devDependencies": {
"@0x/abi-gen": "^3.1.2",
"@0x/contracts-gen": "^1.0.12",
"@0x/contracts-test-utils": "^3.1.12",
"@0x/dev-utils": "^2.2.6",
"@0x/sol-compiler": "^3.1.11",
"@0x/abi-gen": "^4.1.0",
"@0x/contracts-gen": "^1.0.13",
"@0x/contracts-test-utils": "^3.1.13",
"@0x/dev-utils": "^2.3.0",
"@0x/sol-compiler": "^3.1.12",
"@0x/tslint-config": "^3.0.1",
"@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7",
@@ -69,18 +69,18 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^5.3.0",
"@0x/contracts-asset-proxy": "^2.2.4",
"@0x/contracts-erc1155": "^1.1.11",
"@0x/contracts-erc20": "^2.2.10",
"@0x/contracts-erc721": "^2.1.11",
"@0x/contracts-exchange-libs": "^3.0.4",
"@0x/contracts-utils": "^3.2.0",
"@0x/order-utils": "^8.2.4",
"@0x/base-contract": "^5.3.1",
"@0x/contracts-asset-proxy": "^2.2.5",
"@0x/contracts-erc1155": "^1.1.12",
"@0x/contracts-erc20": "^2.2.11",
"@0x/contracts-erc721": "^2.1.12",
"@0x/contracts-exchange-libs": "^3.0.5",
"@0x/contracts-utils": "^3.2.1",
"@0x/order-utils": "^8.2.5",
"@0x/types": "^2.4.1",
"@0x/typescript-typings": "^4.2.4",
"@0x/utils": "^4.4.2",
"@0x/web3-wrapper": "^6.0.9",
"@0x/utils": "^4.5.0",
"@0x/web3-wrapper": "^6.0.10",
"ethereum-types": "^2.1.4",
"ethereumjs-util": "^5.1.1",
"lodash": "^4.17.11"

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1565296576,
"version": "4.0.5",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "4.0.4",
"changes": [

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v4.0.5 - _August 8, 2019_
* Dependencies updated
## v4.0.4 - _July 31, 2019_
* Updated calls to <contract wrapper>.deployFrom0xArtifactAsync to include artifact dependencies. (#1995)

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-extensions",
"version": "4.0.4",
"version": "4.0.5",
"engines": {
"node": ">=6.12"
},
@@ -47,12 +47,12 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/extensions/README.md",
"devDependencies": {
"@0x/abi-gen": "^3.1.2",
"@0x/contract-wrappers": "^10.1.0",
"@0x/contracts-gen": "^1.0.12",
"@0x/contracts-test-utils": "^3.1.12",
"@0x/dev-utils": "^2.2.6",
"@0x/sol-compiler": "^3.1.11",
"@0x/abi-gen": "^4.1.0",
"@0x/contract-wrappers": "9.1.7",
"@0x/contracts-gen": "^1.0.13",
"@0x/contracts-test-utils": "^3.1.13",
"@0x/dev-utils": "^2.3.0",
"@0x/sol-compiler": "^3.1.12",
"@0x/tslint-config": "^3.0.1",
"@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7",
@@ -70,18 +70,18 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^5.3.0",
"@0x/contracts-asset-proxy": "^2.2.4",
"@0x/contracts-erc20": "^2.2.10",
"@0x/contracts-erc721": "^2.1.11",
"@0x/contracts-exchange": "^2.1.10",
"@0x/contracts-exchange-libs": "^3.0.4",
"@0x/contracts-utils": "^3.2.0",
"@0x/order-utils": "^8.2.4",
"@0x/base-contract": "^5.3.1",
"@0x/contracts-asset-proxy": "^2.2.5",
"@0x/contracts-erc20": "^2.2.11",
"@0x/contracts-erc721": "^2.1.12",
"@0x/contracts-exchange": "^2.1.11",
"@0x/contracts-exchange-libs": "^3.0.5",
"@0x/contracts-utils": "^3.2.1",
"@0x/order-utils": "^8.2.5",
"@0x/types": "^2.4.1",
"@0x/typescript-typings": "^4.2.4",
"@0x/utils": "^4.4.2",
"@0x/web3-wrapper": "^6.0.9",
"@0x/utils": "^4.5.0",
"@0x/web3-wrapper": "^6.0.10",
"ethereum-types": "^2.1.4",
"lodash": "^4.17.11"
},

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1565296576,
"version": "3.1.11",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "3.1.10",
"changes": [

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v3.1.11 - _August 8, 2019_
* Dependencies updated
## v3.1.10 - _July 31, 2019_
* Updated calls to <contract wrapper>.deployFrom0xArtifactAsync to include artifact dependencies. (#1995)

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-multisig",
"version": "3.1.10",
"version": "3.1.11",
"engines": {
"node": ">=6.12"
},
@@ -47,11 +47,11 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/multisig/README.md",
"devDependencies": {
"@0x/abi-gen": "^3.1.2",
"@0x/contracts-gen": "^1.0.12",
"@0x/contracts-test-utils": "^3.1.12",
"@0x/dev-utils": "^2.2.6",
"@0x/sol-compiler": "^3.1.11",
"@0x/abi-gen": "^4.1.0",
"@0x/contracts-gen": "^1.0.13",
"@0x/contracts-test-utils": "^3.1.13",
"@0x/dev-utils": "^2.3.0",
"@0x/sol-compiler": "^3.1.12",
"@0x/tslint-config": "^3.0.1",
"@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7",
@@ -69,14 +69,14 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^5.3.0",
"@0x/contracts-asset-proxy": "^2.2.4",
"@0x/contracts-erc20": "^2.2.10",
"@0x/base-contract": "^5.3.1",
"@0x/contracts-asset-proxy": "^2.2.5",
"@0x/contracts-erc20": "^2.2.11",
"@0x/contracts-utils": "2.0.1",
"@0x/types": "^2.4.1",
"@0x/typescript-typings": "^4.2.4",
"@0x/utils": "^4.4.2",
"@0x/web3-wrapper": "^6.0.9",
"@0x/utils": "^4.5.0",
"@0x/web3-wrapper": "^6.0.10",
"ethereum-types": "^2.1.4",
"lodash": "^4.17.11"
},

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1565296576,
"version": "3.1.13",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1564604963,
"version": "3.1.12",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v3.1.13 - _August 8, 2019_
* Dependencies updated
## v3.1.12 - _July 31, 2019_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-test-utils",
"version": "3.1.12",
"version": "3.1.13",
"engines": {
"node": ">=6.12"
},
@@ -42,18 +42,18 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/dev-utils": "^2.2.6",
"@0x/order-utils": "^8.2.4",
"@0x/sol-compiler": "^3.1.11",
"@0x/sol-coverage": "^3.0.8",
"@0x/sol-profiler": "^3.1.10",
"@0x/sol-trace": "^2.0.16",
"@0x/subproviders": "^5.0.0",
"@0x/dev-utils": "^2.3.0",
"@0x/order-utils": "^8.2.5",
"@0x/sol-compiler": "^3.1.12",
"@0x/sol-coverage": "^3.0.9",
"@0x/sol-profiler": "^3.1.11",
"@0x/sol-trace": "^2.0.17",
"@0x/subproviders": "^5.0.1",
"@0x/tslint-config": "^3.0.1",
"@0x/types": "^2.4.1",
"@0x/typescript-typings": "^4.2.4",
"@0x/utils": "^4.4.2",
"@0x/web3-wrapper": "^6.0.9",
"@0x/utils": "^4.5.0",
"@0x/web3-wrapper": "^6.0.10",
"@types/bn.js": "^4.11.0",
"@types/js-combinatorics": "^0.5.29",
"@types/lodash": "4.14.104",

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1565296576,
"version": "3.2.1",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "3.2.0",
"changes": [

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v3.2.1 - _August 8, 2019_
* Dependencies updated
## v3.2.0 - _July 31, 2019_
* Updated calls to <contract wrapper>.deployFrom0xArtifactAsync to include artifact dependencies. (#1995)

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-utils",
"version": "3.2.0",
"version": "3.2.1",
"engines": {
"node": ">=6.12"
},
@@ -47,11 +47,11 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/utils/README.md",
"devDependencies": {
"@0x/abi-gen": "^3.1.2",
"@0x/contracts-gen": "^1.0.12",
"@0x/contracts-test-utils": "^3.1.12",
"@0x/dev-utils": "^2.2.6",
"@0x/sol-compiler": "^3.1.11",
"@0x/abi-gen": "^4.1.0",
"@0x/contracts-gen": "^1.0.13",
"@0x/contracts-test-utils": "^3.1.13",
"@0x/dev-utils": "^2.3.0",
"@0x/sol-compiler": "^3.1.12",
"@0x/tslint-config": "^3.0.1",
"@types/bn.js": "^4.11.0",
"@types/lodash": "4.14.104",
@@ -70,12 +70,12 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^5.3.0",
"@0x/order-utils": "^8.2.4",
"@0x/base-contract": "^5.3.1",
"@0x/order-utils": "^8.2.5",
"@0x/types": "^2.4.1",
"@0x/typescript-typings": "^4.2.4",
"@0x/utils": "^4.4.2",
"@0x/web3-wrapper": "^6.0.9",
"@0x/utils": "^4.5.0",
"@0x/web3-wrapper": "^6.0.10",
"bn.js": "^4.11.8",
"ethereum-types": "^2.1.4",
"ethereumjs-util": "^5.1.1",

View File

@@ -50,7 +50,7 @@
"config": {
"contractsPackages": "@0x/contracts-asset-proxy @0x/contracts-erc20 @0x/contracts-erc721 @0x/contracts-erc1155 @0x/contracts-exchange @0x/contracts-exchange-forwarder @0x/contracts-exchange-libs @0x/contracts-extensions @0x/contracts-multisig @0x/contracts-test-utils @0x/contracts-utils @0x/contracts-coordinator @0x/contracts-dev-utils",
"mnemonic": "concert load couple harbor equip island argue ramp clarify fence smart topic",
"packagesWithDocPages": "0x.js connect json-schemas subproviders web3-wrapper contract-wrappers order-utils order-watcher sol-compiler sol-coverage sol-profiler sol-trace ethereum-types asset-buyer migrations",
"packagesWithDocPages": "0x.js connect json-schemas subproviders web3-wrapper order-utils order-watcher sol-compiler sol-coverage sol-profiler sol-trace ethereum-types asset-buyer migrations",
"ignoreDependencyVersions": "@types/styled-components @types/node",
"ignoreDependencyVersionsForPackage": "website instant dev-tools-pages"
},
@@ -77,7 +77,7 @@
"graceful-fs": "4.1.15"
},
"devDependencies": {
"@0x-lerna-fork/lerna": "3.16.9",
"@0x-lerna-fork/lerna": "3.16.10",
"@0xproject/npm-cli-login": "^0.0.11",
"async-child-process": "^1.1.1",
"bundlewatch": "^0.2.1",

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1565296576,
"version": "6.0.15",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1564604963,
"version": "6.0.14",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v6.0.15 - _August 8, 2019_
* Dependencies updated
## v6.0.14 - _July 31, 2019_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "0x.js",
"version": "6.0.14",
"version": "6.0.15",
"engines": {
"node": ">=6.12"
},
@@ -43,10 +43,10 @@
},
"license": "Apache-2.0",
"devDependencies": {
"@0x/abi-gen-wrappers": "^5.1.0",
"@0x/contract-addresses": "^3.0.2",
"@0x/dev-utils": "^2.2.6",
"@0x/migrations": "^4.1.11",
"@0x/abi-gen-wrappers": "^5.2.0",
"@0x/contract-addresses": "^3.0.3",
"@0x/dev-utils": "^2.3.0",
"@0x/migrations": "^4.2.0",
"@0x/tslint-config": "^3.0.1",
"@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7",
@@ -73,17 +73,17 @@
"webpack": "^4.20.2"
},
"dependencies": {
"@0x/assert": "^2.1.2",
"@0x/asset-swapper": "^1.0.0",
"@0x/base-contract": "^5.3.0",
"@0x/contract-wrappers": "^10.1.0",
"@0x/order-utils": "^8.2.4",
"@0x/order-watcher": "^4.0.16",
"@0x/subproviders": "^5.0.0",
"@0x/assert": "^2.1.3",
"@0x/asset-swapper": "^1.0.1",
"@0x/base-contract": "^5.3.1",
"@0x/contract-wrappers": "9.1.7",
"@0x/order-utils": "^8.2.5",
"@0x/order-watcher": "^4.0.17",
"@0x/subproviders": "^5.0.1",
"@0x/types": "^2.4.1",
"@0x/typescript-typings": "^4.2.4",
"@0x/utils": "^4.4.2",
"@0x/web3-wrapper": "^6.0.9",
"@0x/utils": "^4.5.0",
"@0x/web3-wrapper": "^6.0.10",
"@types/web3-provider-engine": "^14.0.0",
"ethereum-types": "^2.1.4",
"ethers": "~4.0.4",

View File

@@ -40,6 +40,13 @@ export {
} from '@0x/contract-wrappers';
export {
DutchAuctionContract,
ERC20ProxyContract,
ERC721ProxyContract,
ExchangeContract,
ForwarderContract,
OrderValidatorContract,
WETH9Contract,
WETH9Events,
WETH9WithdrawalEventArgs,
WETH9ApprovalEventArgs,
@@ -102,15 +109,12 @@ export {
ObjectMap,
OrderRelevantState,
Stats,
DutchAuctionDetails,
ZeroExTransaction,
SignedZeroExTransaction,
} from '@0x/types';
export {
BlockParamLiteral,
ContractAbi,
BlockParam,
LogWithDecodedArgs,
ContractEventArg,
SupportedProvider,

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1565296576,
"version": "2.4.1",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "2.4.0",
"changes": [

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v2.4.1 - _August 8, 2019_
* Dependencies updated
## v2.4.0 - _July 31, 2019_
* Updated interface to `deployFrom0xArtifactAsync` to include log decode dependencies. (#1995)

View File

@@ -11,37 +11,18 @@ from typing import ( # pylint: disable=unused-import
Union,
)
from eth_utils import to_checksum_address
from mypy_extensions import TypedDict # pylint: disable=unused-import
from hexbytes import HexBytes
from web3 import Web3
from web3.contract import ContractFunction
from web3.datastructures import AttributeDict
from web3.providers.base import BaseProvider
from zero_ex.contract_wrappers._base_contract_wrapper import BaseContractWrapper
from zero_ex.contract_wrappers.bases import ContractMethod, Validator
from zero_ex.contract_wrappers.tx_params import TxParams
class {{contractName}}ValidatorBase:
"""Base class for validating inputs to {{contractName}} methods."""
def __init__(
self,
provider: BaseProvider,
contract_address: str,
private_key: str = None,
):
"""Initialize the instance."""
def assert_valid(
self, method_name: str, parameter_name: str, argument_value: Any
):
"""Raise an exception if method input is not valid.
:param method_name: Name of the method whose input is to be validated.
:param parameter_name: Name of the parameter whose input is to be
validated.
:param argument_value: Value of argument to parameter to be validated.
"""
# Try to import a custom validator class definition; if there isn't one,
# declare one that we can instantiate for the default argument to the
# constructor for {{contractName}} below.
@@ -53,56 +34,58 @@ try:
)
except ImportError:
class {{contractName}}Validator({{contractName}}ValidatorBase): # type: ignore
class {{contractName}}Validator( # type: ignore
Validator
):
"""No-op input validator."""
{{tupleDefinitions ABIString}}
{{#each methods}}
{{> method_class contractName=../contractName}}
{{/each}}
# pylint: disable=too-many-public-methods
class {{contractName}}(BaseContractWrapper):
# pylint: disable=too-many-public-methods,too-many-instance-attributes
class {{contractName}}:
"""Wrapper class for {{contractName}} Solidity contract.{{docBytesIfNecessary ABIString}}"""
{{#each methods}}
{{toPythonIdentifier this.languageSpecificName}}: {{toPythonClassname this.languageSpecificName}}Method
"""Constructor-initialized instance of
:class:`{{toPythonClassname this.languageSpecificName}}Method`.
"""
{{/each}}
def __init__(
self,
provider: BaseProvider,
contract_address: str,
validator: {{contractName}}Validator = None,
private_key: str = None,
):
"""Get an instance of wrapper for smart contract.
:param provider: instance of :class:`web3.providers.base.BaseProvider`
:param contract_address: where the contract has been deployed
:param private_key: If specified, transactions will be signed locally,
via Web3.py's `eth.account.signTransaction()`:code:, before being
sent via `eth.sendRawTransaction()`:code:.
:param validator: for validation of method inputs.
"""
super().__init__(
provider=provider,
contract_address=contract_address,
private_key=private_key,
)
self.contract_address = contract_address
if not validator:
validator = {{contractName}}Validator(provider, contract_address, private_key)
validator = {{contractName}}Validator(provider, contract_address)
self.validator = validator
self._web3_eth = Web3( # type: ignore # pylint: disable=no-member
provider
).eth
def _get_contract_instance(self, token_address):
"""Get an instance of the smart contract at a specific address.
functions = self._web3_eth.contract(address=to_checksum_address(contract_address), abi={{contractName}}.abi()).functions
:returns: contract object
"""
return self._contract_instance(
address=token_address, abi={{contractName}}.abi()
)
{{#each methods}}
{{> call contractName=../contractName}}
{{/each}}
{{#each methods}}
self.{{toPythonIdentifier this.languageSpecificName}} = {{toPythonClassname this.languageSpecificName}}Method(provider, contract_address, functions.{{this.name}}, validator)
{{/each}}
{{#each events}}
{{> event}}
{{> event contractName=../contractName}}
{{/each}}
@staticmethod

View File

@@ -1,54 +0,0 @@
def {{this.languageSpecificName}}(
self,
{{> typed_params inputs=inputs}}
tx_params: Optional[TxParams] = None,
{{^this.constant}}
view_only: bool = False,
{{/this.constant}}
) -> {{> return_type outputs=outputs~}}:
"""Execute underlying, same-named contract method.
{{sanitizeDevdocDetails this.name this.devdoc.details 8}}{{~#if this.devdoc.params~}}{{#each this.devdoc.params}}
{{makeParameterDocstringRole @key this 8}}{{/each}}{{/if}}
:param tx_params: transaction parameters
{{#if this.constant~}}
{{#if this.devdoc.return}}
{{makeReturnDocstringRole this.devdoc.return 8}}{{/if}}
{{else}}
:param view_only: whether to use transact() or call()
:returns: if param `view_only`:code: is `True`:code:, then returns the
value returned from the underlying function; else returns the
transaction hash.
{{/if}}
"""
{{#each this.inputs}}
self.validator.assert_valid(
method_name='{{../name}}',
parameter_name='{{name}}',
argument_value={{toPythonIdentifier name}},
)
{{#if (equal type 'address')}}
{{toPythonIdentifier this.name}} = self._validate_and_checksum_address({{toPythonIdentifier this.name}})
{{else if (equal type 'uint256')}}
# safeguard against fractional inputs
{{toPythonIdentifier this.name}} = int({{toPythonIdentifier this.name}})
{{else if (equal type 'bytes')}}
{{toPythonIdentifier this.name}} = bytes.fromhex({{toPythonIdentifier this.name}}.decode("utf-8"))
{{else if (equal type 'bytes[]')}}
{{toPythonIdentifier this.name}} = [
bytes.fromhex({{toPythonIdentifier this.name}}_element.decode("utf-8"))
for {{toPythonIdentifier this.name}}_element in {{toPythonIdentifier this.name}}
]
{{/if}}
{{/each}}
func = self._get_contract_instance(
self.contract_address
).functions.{{this.name}}(
{{> params}}
)
return self._invoke_function_call(
func=func,
tx_params=tx_params,
view_only={{#if this.constant}}True{{else}}view_only{{/if}}
)

View File

@@ -6,8 +6,4 @@
{{makeEventParameterDocstringRole name 8}}
"""
tx_receipt = self._web3_eth.getTransactionReceipt(tx_hash)
return (
self._get_contract_instance(self.contract_address)
.events.{{name}}()
.processReceipt(tx_receipt)
)
return self._web3_eth.contract(address=to_checksum_address(self.contract_address), abi={{contractName}}.abi()).events.{{name}}().processReceipt(tx_receipt)

View File

@@ -0,0 +1,76 @@
class {{toPythonClassname this.languageSpecificName}}Method(ContractMethod):
"""Various interfaces to the {{this.name}} method."""
def __init__(self, provider: BaseProvider, contract_address: str, contract_function: ContractFunction, validator: Validator=None):
"""Persist instance data."""
super().__init__(provider, contract_address, validator)
self.underlying_method = contract_function
{{#if inputs}}
def validate_and_normalize_inputs(self, {{> typed_params inputs=inputs}}):
"""Validate the inputs to the {{this.name}} method."""
{{#each this.inputs}}
self.validator.assert_valid(
method_name='{{../name}}',
parameter_name='{{name}}',
argument_value={{toPythonIdentifier name}},
)
{{#if (equal type 'address')}}
{{toPythonIdentifier this.name}} = self.validate_and_checksum_address({{toPythonIdentifier this.name}})
{{else if (equal type 'uint256')}}
# safeguard against fractional inputs
{{toPythonIdentifier this.name}} = int({{toPythonIdentifier this.name}})
{{else if (equal type 'bytes')}}
{{toPythonIdentifier this.name}} = bytes.fromhex({{toPythonIdentifier this.name}}.decode("utf-8"))
{{else if (equal type 'bytes[]')}}
{{toPythonIdentifier this.name}} = [
bytes.fromhex({{toPythonIdentifier this.name}}_element.decode("utf-8"))
for {{toPythonIdentifier this.name}}_element in {{toPythonIdentifier this.name}}
]
{{/if}}
{{/each}}
return ({{> params }})
{{/if}}
def call(self, {{#if inputs}}{{> typed_params inputs=inputs}}, {{/if}}tx_params: Optional[TxParams] = None) -> {{> return_type outputs=outputs type='call'~}}:
"""Execute underlying contract method via eth_call.
{{sanitizeDevdocDetails this.name this.devdoc.details 8}}{{~#if this.devdoc.params~}}{{#each this.devdoc.params}}
{{makeParameterDocstringRole @key this 8}}{{/each}}{{/if}}
:param tx_params: transaction parameters
{{#if this.constant~}}
{{#if this.devdoc.return}}
{{makeReturnDocstringRole this.devdoc.return 8}}{{/if}}
{{else}}
:returns: the return value of the underlying method.
{{/if}}
"""
{{#if inputs}}
({{> params }}) = self.validate_and_normalize_inputs({{> params}})
{{/if}}
tx_params = super().normalize_tx_params(tx_params)
return self.underlying_method({{> params}}).call(tx_params.as_dict())
def send_transaction(self, {{#if inputs}}{{> typed_params inputs=inputs}}, {{/if}}tx_params: Optional[TxParams] = None) -> Union[HexBytes, bytes]:
"""Execute underlying contract method via eth_sendTransaction.
{{sanitizeDevdocDetails this.name this.devdoc.details 8}}{{~#if this.devdoc.params~}}{{#each this.devdoc.params}}
{{makeParameterDocstringRole @key this 8}}{{/each}}{{/if}}
:param tx_params: transaction parameters
{{#if this.constant~}}
{{#if this.devdoc.return}}
{{makeReturnDocstringRole this.devdoc.return 8}}{{/if}}
{{/if}}
"""
{{#if inputs}}
({{> params }}) = self.validate_and_normalize_inputs({{> params}})
{{/if}}
tx_params = super().normalize_tx_params(tx_params)
return self.underlying_method({{> params}}).transact(tx_params.as_dict())
def estimate_gas(self, {{#if inputs}}{{> typed_params inputs=inputs}}, {{/if}}tx_params: Optional[TxParams] = None) -> int:
"""Estimate gas consumption of method call."""
{{#if inputs}}
({{> params }}) = self.validate_and_normalize_inputs({{> params}})
{{/if}}
tx_params = super().normalize_tx_params(tx_params)
return self.underlying_method({{> params}}).estimateGas(tx_params.as_dict())

View File

@@ -1,3 +1,3 @@
{{#each inputs}}
{{toPythonIdentifier name}}{{#if @last}}{{else}},{{/if}}
{{/each}}
{{toPythonIdentifier name}}{{#if @last}}{{else}}, {{/if~}}
{{/each~}}

View File

@@ -7,8 +7,8 @@ Union[
{{#returnType outputs.0.type outputs.0.components}}{{~/returnType~}}
{{/singleReturnValue}}
{{^singleReturnValue}}
[{{#each outputs}}{{#returnType type components}}{{/returnType}}{{#unless @last}}, {{/unless}}{{/each}}]
{{/singleReturnValue}}
Tuple[{{#each outputs}}{{#returnType type components}}{{/returnType}}{{#unless @last}}, {{/unless}}{{/each}}]
{{~/singleReturnValue}}
{{else}}None
{{/if}}{{^if this.constant}}, Union[HexBytes, bytes]]{{/if~}}
{{else}}{{#if this.constant}}None{{else}}Union[None, Union[HexBytes, bytes]]{{/if}}{{/if~}}

View File

@@ -1,3 +1,3 @@
{{#each inputs}}
{{toPythonIdentifier name}}: {{#parameterType type components}}{{/parameterType}},
{{/each}}
{{toPythonIdentifier name}}: {{#parameterType type components}}{{/parameterType}}{{^if @last}}, {{/if~}}
{{/each~}}

View File

@@ -51,6 +51,11 @@ export enum {{contractName}}Events {
// tslint:disable-next-line:class-name
export class {{contractName}}Contract extends BaseContract {
{{#each methods}}
{{#if this.devdoc.details}}
/**
* {{formatDocstringForMethodTs this.devdoc.details}}
*/
{{/if}}
{{#this.constant}}
{{> call contractName=../contractName}}
{{/this.constant}}
@@ -78,8 +83,10 @@ export class {{contractName}}Contract extends BaseContract {
const bytecode = artifact.compilerOutput.evm.bytecode.object;
const abi = artifact.compilerOutput.abi;
const logDecodeDependenciesAbiOnly: { [contractName: string]: ContractAbi } = {};
for (const key of Object.keys(logDecodeDependencies)) {
logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi;
if (Object.keys(logDecodeDependencies) !== undefined) {
for (const key of Object.keys(logDecodeDependencies)) {
logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi;
}
}
return {{contractName}}Contract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly, {{> params inputs=ctor.inputs}});
}
@@ -153,11 +160,11 @@ export class {{contractName}}Contract extends BaseContract {
}{{#if events}}
/**
* Subscribe to an event type emitted by the {{contractName}} contract.
* @param eventName The {{contractName}} contract event you would like to subscribe to.
* @param indexFilterValues An object where the keys are indexed args returned by the event and
* the value is the value you are interested in. E.g `{maker: aUserAddressHex}`
* @param callback Callback that gets called when a log is added/removed
* @param isVerbose Enable verbose subscription warnings (e.g recoverable network issues encountered)
* @param eventName The {{contractName}} contract event you would like to subscribe to.
* @param indexFilterValues An object where the keys are indexed args returned by the event and
* the value is the value you are interested in. E.g `{maker: aUserAddressHex}`
* @param callback Callback that gets called when a log is added/removed
* @param isVerbose Enable verbose subscription warnings (e.g recoverable network issues encountered)
* @return Subscription token used later to unsubscribe
*/
public subscribe<ArgsType extends {{contractName}}EventArgs>(
@@ -183,7 +190,7 @@ export class {{contractName}}Contract extends BaseContract {
}
/**
* Cancel a subscription
* @param subscriptionToken Subscription token returned by `subscribe()`
* @param subscriptionToken Subscription token returned by `subscribe()`
*/
public unsubscribe(subscriptionToken: string): void {
this._subscriptionManager.unsubscribe(subscriptionToken);
@@ -196,11 +203,11 @@ export class {{contractName}}Contract extends BaseContract {
}
/**
* Gets historical logs without creating a subscription
* @param eventName The {{contractName}} contract event you would like to subscribe to.
* @param blockRange Block range to get logs from.
* @param indexFilterValues An object where the keys are indexed args returned by the event and
* the value is the value you are interested in. E.g `{_from: aUserAddressHex}`
* @return Array of logs that match the parameters
* @param eventName The {{contractName}} contract event you would like to subscribe to.
* @param blockRange Block range to get logs from.
* @param indexFilterValues An object where the keys are indexed args returned by the event and
* the value is the value you are interested in. E.g `{_from: aUserAddressHex}`
* @return Array of logs that match the parameters
*/
public async getLogsAsync<ArgsType extends {{contractName}}EventArgs>(
eventName: {{contractName}}Events,

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/abi-gen-templates",
"version": "2.4.0",
"version": "2.4.1",
"engines": {
"node": ">=6.12"
},

View File

@@ -1,3 +1,12 @@
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
{{> params_docstring inputs=inputs docstrings=devdoc.params}}
{{#if devdoc.return}}
* @returns {{devdoc.return}}
{{/if}}
*/
async callAsync(
{{> typed_params inputs=inputs}}
callData: Partial<CallData> = {},
@@ -34,6 +43,12 @@ async callAsync(
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
{{> params_docstring inputs=inputs docstrings=devdoc.params}}
*/
getABIEncodedTransactionData(
{{> typed_params inputs=inputs}}
): string {
@@ -44,3 +59,21 @@ getABIEncodedTransactionData(
const abiEncodedTransactionData = self._strictEncodeArguments('{{this.functionSignature}}', [{{> normalized_params inputs=inputs}}]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(
callData: string
): ({{> return_type inputs=inputs ~}}) {
const self = this as any as {{contractName}}Contract;
const abiEncoder = self._lookupAbiEncoder('{{this.functionSignature}}');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<{{> return_type inputs=inputs}}>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(
returnData: string
): ({{> return_type outputs=outputs ~}}) {
const self = this as any as {{contractName}}Contract;
const abiEncoder = self._lookupAbiEncoder('{{this.functionSignature}}');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<{{> return_type outputs=outputs}}>(returnData);
return abiDecodedReturnData;
},

View File

@@ -0,0 +1,5 @@
{{#each inputs}}
{{#if (getDocstringForParamTs name ../docstrings)}}
{{formatDocstringForParamTs name (getDocstringForParamTs name ../docstrings)}}
{{/if}}
{{/each}}

View File

@@ -1,4 +1,11 @@
public {{languageSpecificName}} = {
/**
* Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write
* Ethereum operation and will cost gas.
{{> params_docstring inputs=inputs docstrings=devdoc.params}}
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async sendTransactionAsync(
{{> typed_params inputs=inputs}}
txData?: Partial<TxData> | undefined,
@@ -27,6 +34,14 @@ public {{languageSpecificName}} = {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
/**
* Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting.
* If the transaction was mined, but reverted, an error is thrown.
{{> params_docstring inputs=inputs docstrings=devdoc.params}}
* @param txData Additional data for transaction
* @param pollingIntervalMs Interval at which to poll for success
* @returns A promise that resolves when the transaction is successful
*/
awaitTransactionSuccessAsync(
{{> typed_params inputs=inputs}}
txData?: Partial<TxData>,
@@ -54,6 +69,12 @@ public {{languageSpecificName}} = {
})(),
);
},
/**
* Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments.
{{> params_docstring inputs=inputs docstrings=devdoc.params}}
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async estimateGasAsync(
{{> typed_params inputs=inputs}}
txData?: Partial<TxData> | undefined,

View File

@@ -1,4 +1,14 @@
[
{
"version": "5.2.0",
"changes": [
{
"note": "Updated to include `getABIDecodedTransactionData` and `getABIDecodedReturnData`",
"pr": 2018
}
],
"timestamp": 1565296576
},
{
"version": "5.1.0",
"changes": [

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v5.2.0 - _August 8, 2019_
* Updated to include `getABIDecodedTransactionData` and `getABIDecodedReturnData` (#2018)
## v5.1.0 - _July 31, 2019_
* Add subscribe/unsubscribe methods for events (#1970)

View File

@@ -71,3 +71,9 @@ yarn lint
```bash
yarn test
```
### Documentation
Documentation for this package is generated by TypeDoc, using the Solidity source code for 0x contracts. Each contract corresponds to one global-level module, which contains relevant enums and interfaces for its events and structs. Most significantly, each module exports a class, `<ContractName>Contract`, e.g. `ExchangeContract`, which implements helper methods for all the functions defined in the corresponding contract.
A convention to note is that these contract-specific helper methods are defined as _object literals_, which are separated from methods in the generated documentation. Each contract method has a number of sub-methods, e.g. `sendTransactionAsync`, or `estimateGasAsync`, which are documented separately. This is an example of an expected method call signature: `exchangeContractInstance.fillOrder.sendTransactionAsync(...arguments)`.

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/abi-gen-wrappers",
"version": "5.1.0",
"version": "5.2.0",
"engines": {
"node": ">=6.12"
},
@@ -10,7 +10,7 @@
"test": "test"
},
"scripts": {
"build": "yarn pre_build && tsc -b",
"build": "yarn pre_build && tsc -b && yarn docs",
"build:ci": "yarn build",
"lint": "tslint --format stylish --project .",
"fix": "tslint --fix --format stylish --project .",
@@ -18,10 +18,11 @@
"prettier": "prettier --write src/**/* --config ../../.prettierrc",
"prettier_contract_wrappers": "prettier --write src/generated-wrappers/* --config ../../.prettierrc",
"clean": "shx rm -rf lib src/generated-wrappers",
"generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../../node_modules/@0x/abi-gen-templates/contract.handlebars --partials '../../node_modules/@0x/abi-gen-templates/partials/**/*.handlebars' --output src/generated-wrappers --backend ethers"
"generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../../node_modules/@0x/abi-gen-templates/contract.handlebars --partials '../../node_modules/@0x/abi-gen-templates/partials/**/*.handlebars' --output src/generated-wrappers --backend ethers",
"docs": "typedoc --excludePrivate --excludeExternals --target ES5 --tsconfig typedoc-tsconfig.json --out generated_docs ./src/generated-wrappers/*"
},
"config": {
"abis": "../contract-artifacts/artifacts/@(AssetProxyOwner|DutchAuction|DummyERC20Token|DummyERC721Token|ERC20Proxy|ERC20Token|ERC721Proxy|ERC721Token|Exchange|Forwarder|IAssetProxy|IValidator|IWallet|MultiAssetProxy|OrderValidator|WETH9|ZRXToken|Coordinator|CoordinatorRegistry|EthBalanceChecker).json"
"abis": "../contract-artifacts/artifacts/@(AssetProxyOwner|DutchAuction|DummyERC20Token|DummyERC721Token|ERC20Proxy|ERC20Token|ERC721Proxy|ERC721Token|Exchange|Forwarder|IAssetProxy|IValidator|IWallet|MultiAssetProxy|OrderValidator|WETH9|ZRXToken|Coordinator|CoordinatorRegistry|EthBalanceChecker|ERC1155Proxy|StaticCallProxy).json"
},
"repository": {
"type": "git",
@@ -33,23 +34,23 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/abi-gen-wrappers/README.md",
"devDependencies": {
"@0x/abi-gen": "^3.1.2",
"@0x/abi-gen-templates": "^2.4.0",
"@0x/assert": "^2.1.2",
"@0x/json-schemas": "^3.1.12",
"@0x/abi-gen": "^4.1.0",
"@0x/abi-gen-templates": "^2.4.1",
"@0x/assert": "^2.1.3",
"@0x/json-schemas": "^3.1.13",
"@0x/tslint-config": "^3.0.1",
"@0x/types": "^2.4.1",
"@0x/utils": "^4.4.2",
"@0x/web3-wrapper": "^6.0.9",
"@0x/utils": "^4.5.0",
"@0x/web3-wrapper": "^6.0.10",
"ethereum-types": "^2.1.4",
"ethers": "~4.0.4",
"lodash": "^4.17.11",
"shx": "^0.2.2"
},
"dependencies": {
"@0x/base-contract": "^5.3.0",
"@0x/contract-addresses": "^3.0.2",
"@0x/contract-artifacts": "^2.0.3"
"@0x/base-contract": "^5.3.1",
"@0x/contract-addresses": "^3.0.3",
"@0x/contract-artifacts": "^2.0.4"
},
"publishConfig": {
"access": "public"

File diff suppressed because it is too large Load Diff

View File

@@ -27,7 +27,17 @@ import * as ethers from 'ethers';
// tslint:disable:no-parameter-reassignment
// tslint:disable-next-line:class-name
export class CoordinatorContract extends BaseContract {
/**
* Recovers the address of a signer given a hash and signature.
*/
public getSignerAddress = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @param hash Any 32 byte hash.
* @param signature Proof that the hash has been signed by signer.
*/
async callAsync(
hash: string,
signature: string,
@@ -66,6 +76,13 @@ export class CoordinatorContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
* @param hash Any 32 byte hash.
* @param signature Proof that the hash has been signed by signer.
*/
getABIEncodedTransactionData(hash: string, signature: string): string {
assert.isString('hash', hash);
assert.isString('signature', signature);
@@ -76,8 +93,32 @@ export class CoordinatorContract extends BaseContract {
]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): string {
const self = (this as any) as CoordinatorContract;
const abiEncoder = self._lookupAbiEncoder('getSignerAddress(bytes32,bytes)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<string>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): string {
const self = (this as any) as CoordinatorContract;
const abiEncoder = self._lookupAbiEncoder('getSignerAddress(bytes32,bytes)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<string>(returnData);
return abiDecodedReturnData;
},
};
/**
* Calculates the EIP712 hash of a 0x transaction using the domain separator of the Exchange contract.
*/
public getTransactionHash = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @param transaction 0x transaction containing salt, signerAddress, and data.
* @returns EIP712 hash of the transaction with the domain separator of this contract.
*/
async callAsync(
transaction: { salt: BigNumber; signerAddress: string; data: string },
callData: Partial<CallData> = {},
@@ -115,6 +156,12 @@ export class CoordinatorContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
* @param transaction 0x transaction containing salt, signerAddress, and data.
*/
getABIEncodedTransactionData(transaction: { salt: BigNumber; signerAddress: string; data: string }): string {
const self = (this as any) as CoordinatorContract;
const abiEncodedTransactionData = self._strictEncodeArguments(
@@ -123,8 +170,33 @@ export class CoordinatorContract extends BaseContract {
);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): string {
const self = (this as any) as CoordinatorContract;
const abiEncoder = self._lookupAbiEncoder('getTransactionHash((uint256,address,bytes))');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<string>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): string {
const self = (this as any) as CoordinatorContract;
const abiEncoder = self._lookupAbiEncoder('getTransactionHash((uint256,address,bytes))');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<string>(returnData);
return abiDecodedReturnData;
},
};
/**
* Calculated the EIP712 hash of the Coordinator approval mesasage using the domain separator of this contract.
*/
public getCoordinatorApprovalHash = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @param approval Coordinator approval message containing the transaction
* hash, transaction signature, and expiration of the approval.
* @returns EIP712 hash of the Coordinator approval message with the domain separator of this contract.
*/
async callAsync(
approval: {
txOrigin: string;
@@ -168,6 +240,13 @@ export class CoordinatorContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
* @param approval Coordinator approval message containing the transaction
* hash, transaction signature, and expiration of the approval.
*/
getABIEncodedTransactionData(approval: {
txOrigin: string;
transactionHash: string;
@@ -181,8 +260,40 @@ export class CoordinatorContract extends BaseContract {
);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): string {
const self = (this as any) as CoordinatorContract;
const abiEncoder = self._lookupAbiEncoder('getCoordinatorApprovalHash((address,bytes32,bytes,uint256))');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<string>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): string {
const self = (this as any) as CoordinatorContract;
const abiEncoder = self._lookupAbiEncoder('getCoordinatorApprovalHash((address,bytes32,bytes,uint256))');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<string>(returnData);
return abiDecodedReturnData;
},
};
/**
* Executes a 0x transaction that has been signed by the feeRecipients that correspond to each order in the transaction's Exchange calldata.
*/
public executeTransaction = {
/**
* Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write
* Ethereum operation and will cost gas.
* @param transaction 0x transaction containing salt, signerAddress, and data.
* @param txOrigin Required signer of Ethereum transaction calling this
* function.
* @param transactionSignature Proof that the transaction has been signed by
* the signer.
* @param approvalExpirationTimeSeconds Array of expiration times in seconds
* for which each corresponding approval signature expires.
* @param approvalSignatures Array of signatures that correspond to the
* feeRecipients of each order in the transaction's Exchange calldata.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async sendTransactionAsync(
transaction: { salt: BigNumber; signerAddress: string; data: string },
txOrigin: string,
@@ -229,6 +340,22 @@ export class CoordinatorContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
/**
* Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting.
* If the transaction was mined, but reverted, an error is thrown.
* @param transaction 0x transaction containing salt, signerAddress, and data.
* @param txOrigin Required signer of Ethereum transaction calling this
* function.
* @param transactionSignature Proof that the transaction has been signed by
* the signer.
* @param approvalExpirationTimeSeconds Array of expiration times in seconds
* for which each corresponding approval signature expires.
* @param approvalSignatures Array of signatures that correspond to the
* feeRecipients of each order in the transaction's Exchange calldata.
* @param txData Additional data for transaction
* @param pollingIntervalMs Interval at which to poll for success
* @returns A promise that resolves when the transaction is successful
*/
awaitTransactionSuccessAsync(
transaction: { salt: BigNumber; signerAddress: string; data: string },
txOrigin: string,
@@ -264,6 +391,20 @@ export class CoordinatorContract extends BaseContract {
})(),
);
},
/**
* Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments.
* @param transaction 0x transaction containing salt, signerAddress, and data.
* @param txOrigin Required signer of Ethereum transaction calling this
* function.
* @param transactionSignature Proof that the transaction has been signed by
* the signer.
* @param approvalExpirationTimeSeconds Array of expiration times in seconds
* for which each corresponding approval signature expires.
* @param approvalSignatures Array of signatures that correspond to the
* feeRecipients of each order in the transaction's Exchange calldata.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async estimateGasAsync(
transaction: { salt: BigNumber; signerAddress: string; data: string },
txOrigin: string,
@@ -302,6 +443,20 @@ export class CoordinatorContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @param transaction 0x transaction containing salt, signerAddress, and data.
* @param txOrigin Required signer of Ethereum transaction calling this
* function.
* @param transactionSignature Proof that the transaction has been signed by
* the signer.
* @param approvalExpirationTimeSeconds Array of expiration times in seconds
* for which each corresponding approval signature expires.
* @param approvalSignatures Array of signatures that correspond to the
* feeRecipients of each order in the transaction's Exchange calldata.
*/
async callAsync(
transaction: { salt: BigNumber; signerAddress: string; data: string },
txOrigin: string,
@@ -356,6 +511,20 @@ export class CoordinatorContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
* @param transaction 0x transaction containing salt, signerAddress, and data.
* @param txOrigin Required signer of Ethereum transaction calling this
* function.
* @param transactionSignature Proof that the transaction has been signed by
* the signer.
* @param approvalExpirationTimeSeconds Array of expiration times in seconds
* for which each corresponding approval signature expires.
* @param approvalSignatures Array of signatures that correspond to the
* feeRecipients of each order in the transaction's Exchange calldata.
*/
getABIEncodedTransactionData(
transaction: { salt: BigNumber; signerAddress: string; data: string },
txOrigin: string,
@@ -380,8 +549,31 @@ export class CoordinatorContract extends BaseContract {
);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): void {
const self = (this as any) as CoordinatorContract;
const abiEncoder = self._lookupAbiEncoder(
'executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])',
);
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<void>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): void {
const self = (this as any) as CoordinatorContract;
const abiEncoder = self._lookupAbiEncoder(
'executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])',
);
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
};
public EIP712_EXCHANGE_DOMAIN_HASH = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
*/
async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<string> {
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
schemas.addressSchema,
@@ -413,13 +605,50 @@ export class CoordinatorContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(): string {
const self = (this as any) as CoordinatorContract;
const abiEncodedTransactionData = self._strictEncodeArguments('EIP712_EXCHANGE_DOMAIN_HASH()', []);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): string {
const self = (this as any) as CoordinatorContract;
const abiEncoder = self._lookupAbiEncoder('EIP712_EXCHANGE_DOMAIN_HASH()');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<string>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): string {
const self = (this as any) as CoordinatorContract;
const abiEncoder = self._lookupAbiEncoder('EIP712_EXCHANGE_DOMAIN_HASH()');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<string>(returnData);
return abiDecodedReturnData;
},
};
/**
* Validates that the 0x transaction has been approved by all of the feeRecipients
* that correspond to each order in the transaction's Exchange calldata.
*/
public assertValidCoordinatorApprovals = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @param transaction 0x transaction containing salt, signerAddress, and data.
* @param txOrigin Required signer of Ethereum transaction calling this
* function.
* @param transactionSignature Proof that the transaction has been signed by
* the signer.
* @param approvalExpirationTimeSeconds Array of expiration times in seconds
* for which each corresponding approval signature expires.
* @param approvalSignatures Array of signatures that correspond to the
* feeRecipients of each order in the transaction's Exchange calldata.
*/
async callAsync(
transaction: { salt: BigNumber; signerAddress: string; data: string },
txOrigin: string,
@@ -474,6 +703,20 @@ export class CoordinatorContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
* @param transaction 0x transaction containing salt, signerAddress, and data.
* @param txOrigin Required signer of Ethereum transaction calling this
* function.
* @param transactionSignature Proof that the transaction has been signed by
* the signer.
* @param approvalExpirationTimeSeconds Array of expiration times in seconds
* for which each corresponding approval signature expires.
* @param approvalSignatures Array of signatures that correspond to the
* feeRecipients of each order in the transaction's Exchange calldata.
*/
getABIEncodedTransactionData(
transaction: { salt: BigNumber; signerAddress: string; data: string },
txOrigin: string,
@@ -498,8 +741,36 @@ export class CoordinatorContract extends BaseContract {
);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): void {
const self = (this as any) as CoordinatorContract;
const abiEncoder = self._lookupAbiEncoder(
'assertValidCoordinatorApprovals((uint256,address,bytes),address,bytes,uint256[],bytes[])',
);
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<void>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): void {
const self = (this as any) as CoordinatorContract;
const abiEncoder = self._lookupAbiEncoder(
'assertValidCoordinatorApprovals((uint256,address,bytes),address,bytes,uint256[],bytes[])',
);
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
};
/**
* Decodes the orders from Exchange calldata representing any fill method.
*/
public decodeOrdersFromFillData = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @param data Exchange calldata representing a fill method.
* @returns The orders from the Exchange calldata.
*/
async callAsync(
data: string,
callData: Partial<CallData> = {},
@@ -566,14 +837,99 @@ export class CoordinatorContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
* @param data Exchange calldata representing a fill method.
*/
getABIEncodedTransactionData(data: string): string {
assert.isString('data', data);
const self = (this as any) as CoordinatorContract;
const abiEncodedTransactionData = self._strictEncodeArguments('decodeOrdersFromFillData(bytes)', [data]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(
callData: string,
): Array<{
makerAddress: string;
takerAddress: string;
feeRecipientAddress: string;
senderAddress: string;
makerAssetAmount: BigNumber;
takerAssetAmount: BigNumber;
makerFee: BigNumber;
takerFee: BigNumber;
expirationTimeSeconds: BigNumber;
salt: BigNumber;
makerAssetData: string;
takerAssetData: string;
}> {
const self = (this as any) as CoordinatorContract;
const abiEncoder = self._lookupAbiEncoder('decodeOrdersFromFillData(bytes)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<
Array<{
makerAddress: string;
takerAddress: string;
feeRecipientAddress: string;
senderAddress: string;
makerAssetAmount: BigNumber;
takerAssetAmount: BigNumber;
makerFee: BigNumber;
takerFee: BigNumber;
expirationTimeSeconds: BigNumber;
salt: BigNumber;
makerAssetData: string;
takerAssetData: string;
}>
>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(
returnData: string,
): Array<{
makerAddress: string;
takerAddress: string;
feeRecipientAddress: string;
senderAddress: string;
makerAssetAmount: BigNumber;
takerAssetAmount: BigNumber;
makerFee: BigNumber;
takerFee: BigNumber;
expirationTimeSeconds: BigNumber;
salt: BigNumber;
makerAssetData: string;
takerAssetData: string;
}> {
const self = (this as any) as CoordinatorContract;
const abiEncoder = self._lookupAbiEncoder('decodeOrdersFromFillData(bytes)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<
Array<{
makerAddress: string;
takerAddress: string;
feeRecipientAddress: string;
senderAddress: string;
makerAssetAmount: BigNumber;
takerAssetAmount: BigNumber;
makerFee: BigNumber;
takerFee: BigNumber;
expirationTimeSeconds: BigNumber;
salt: BigNumber;
makerAssetData: string;
takerAssetData: string;
}>
>(returnData);
return abiDecodedReturnData;
},
};
public EIP712_COORDINATOR_DOMAIN_HASH = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
*/
async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<string> {
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
schemas.addressSchema,
@@ -605,11 +961,30 @@ export class CoordinatorContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(): string {
const self = (this as any) as CoordinatorContract;
const abiEncodedTransactionData = self._strictEncodeArguments('EIP712_COORDINATOR_DOMAIN_HASH()', []);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): string {
const self = (this as any) as CoordinatorContract;
const abiEncoder = self._lookupAbiEncoder('EIP712_COORDINATOR_DOMAIN_HASH()');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<string>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): string {
const self = (this as any) as CoordinatorContract;
const abiEncoder = self._lookupAbiEncoder('EIP712_COORDINATOR_DOMAIN_HASH()');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<string>(returnData);
return abiDecodedReturnData;
},
};
public static async deployFrom0xArtifactAsync(
artifact: ContractArtifact | SimpleContractArtifact,
@@ -630,8 +1005,10 @@ export class CoordinatorContract extends BaseContract {
const bytecode = artifact.compilerOutput.evm.bytecode.object;
const abi = artifact.compilerOutput.abi;
const logDecodeDependenciesAbiOnly: { [contractName: string]: ContractAbi } = {};
for (const key of Object.keys(logDecodeDependencies)) {
logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi;
if (Object.keys(logDecodeDependencies) !== undefined) {
for (const key of Object.keys(logDecodeDependencies)) {
logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi;
}
}
return CoordinatorContract.deployAsync(
bytecode,

View File

@@ -46,7 +46,17 @@ export interface CoordinatorRegistryCoordinatorEndpointSetEventArgs extends Deco
// tslint:disable:no-parameter-reassignment
// tslint:disable-next-line:class-name
export class CoordinatorRegistryContract extends BaseContract {
/**
* Called by a Coordinator operator to set the endpoint of their Coordinator.
*/
public setCoordinatorEndpoint = {
/**
* Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write
* Ethereum operation and will cost gas.
* @param coordinatorEndpoint endpoint of the Coordinator.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async sendTransactionAsync(coordinatorEndpoint: string, txData?: Partial<TxData> | undefined): Promise<string> {
assert.isString('coordinatorEndpoint', coordinatorEndpoint);
const self = (this as any) as CoordinatorRegistryContract;
@@ -67,6 +77,14 @@ export class CoordinatorRegistryContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
/**
* Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting.
* If the transaction was mined, but reverted, an error is thrown.
* @param coordinatorEndpoint endpoint of the Coordinator.
* @param txData Additional data for transaction
* @param pollingIntervalMs Interval at which to poll for success
* @returns A promise that resolves when the transaction is successful
*/
awaitTransactionSuccessAsync(
coordinatorEndpoint: string,
txData?: Partial<TxData>,
@@ -88,6 +106,12 @@ export class CoordinatorRegistryContract extends BaseContract {
})(),
);
},
/**
* Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments.
* @param coordinatorEndpoint endpoint of the Coordinator.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async estimateGasAsync(coordinatorEndpoint: string, txData?: Partial<TxData> | undefined): Promise<number> {
assert.isString('coordinatorEndpoint', coordinatorEndpoint);
const self = (this as any) as CoordinatorRegistryContract;
@@ -107,6 +131,12 @@ export class CoordinatorRegistryContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @param coordinatorEndpoint endpoint of the Coordinator.
*/
async callAsync(
coordinatorEndpoint: string,
callData: Partial<CallData> = {},
@@ -143,6 +173,12 @@ export class CoordinatorRegistryContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
* @param coordinatorEndpoint endpoint of the Coordinator.
*/
getABIEncodedTransactionData(coordinatorEndpoint: string): string {
assert.isString('coordinatorEndpoint', coordinatorEndpoint);
const self = (this as any) as CoordinatorRegistryContract;
@@ -151,8 +187,31 @@ export class CoordinatorRegistryContract extends BaseContract {
]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): void {
const self = (this as any) as CoordinatorRegistryContract;
const abiEncoder = self._lookupAbiEncoder('setCoordinatorEndpoint(string)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<void>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): void {
const self = (this as any) as CoordinatorRegistryContract;
const abiEncoder = self._lookupAbiEncoder('setCoordinatorEndpoint(string)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
};
/**
* Gets the endpoint for a Coordinator.
*/
public getCoordinatorEndpoint = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @param coordinatorOperator operator of the Coordinator endpoint.
*/
async callAsync(
coordinatorOperator: string,
callData: Partial<CallData> = {},
@@ -191,6 +250,12 @@ export class CoordinatorRegistryContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
* @param coordinatorOperator operator of the Coordinator endpoint.
*/
getABIEncodedTransactionData(coordinatorOperator: string): string {
assert.isString('coordinatorOperator', coordinatorOperator);
const self = (this as any) as CoordinatorRegistryContract;
@@ -199,6 +264,20 @@ export class CoordinatorRegistryContract extends BaseContract {
]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): string {
const self = (this as any) as CoordinatorRegistryContract;
const abiEncoder = self._lookupAbiEncoder('getCoordinatorEndpoint(address)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<string>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): string {
const self = (this as any) as CoordinatorRegistryContract;
const abiEncoder = self._lookupAbiEncoder('getCoordinatorEndpoint(address)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<string>(returnData);
return abiDecodedReturnData;
},
};
private readonly _subscriptionManager: SubscriptionManager<CoordinatorRegistryEventArgs, CoordinatorRegistryEvents>;
public static async deployFrom0xArtifactAsync(
@@ -219,8 +298,10 @@ export class CoordinatorRegistryContract extends BaseContract {
const bytecode = artifact.compilerOutput.evm.bytecode.object;
const abi = artifact.compilerOutput.abi;
const logDecodeDependenciesAbiOnly: { [contractName: string]: ContractAbi } = {};
for (const key of Object.keys(logDecodeDependencies)) {
logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi;
if (Object.keys(logDecodeDependencies) !== undefined) {
for (const key of Object.keys(logDecodeDependencies)) {
logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi;
}
}
return CoordinatorRegistryContract.deployAsync(
bytecode,
@@ -337,11 +418,11 @@ export class CoordinatorRegistryContract extends BaseContract {
}
/**
* Subscribe to an event type emitted by the CoordinatorRegistry contract.
* @param eventName The CoordinatorRegistry contract event you would like to subscribe to.
* @param indexFilterValues An object where the keys are indexed args returned by the event and
* the value is the value you are interested in. E.g `{maker: aUserAddressHex}`
* @param callback Callback that gets called when a log is added/removed
* @param isVerbose Enable verbose subscription warnings (e.g recoverable network issues encountered)
* @param eventName The CoordinatorRegistry contract event you would like to subscribe to.
* @param indexFilterValues An object where the keys are indexed args returned by the event and
* the value is the value you are interested in. E.g `{maker: aUserAddressHex}`
* @param callback Callback that gets called when a log is added/removed
* @param isVerbose Enable verbose subscription warnings (e.g recoverable network issues encountered)
* @return Subscription token used later to unsubscribe
*/
public subscribe<ArgsType extends CoordinatorRegistryEventArgs>(
@@ -367,7 +448,7 @@ export class CoordinatorRegistryContract extends BaseContract {
}
/**
* Cancel a subscription
* @param subscriptionToken Subscription token returned by `subscribe()`
* @param subscriptionToken Subscription token returned by `subscribe()`
*/
public unsubscribe(subscriptionToken: string): void {
this._subscriptionManager.unsubscribe(subscriptionToken);
@@ -380,11 +461,11 @@ export class CoordinatorRegistryContract extends BaseContract {
}
/**
* Gets historical logs without creating a subscription
* @param eventName The CoordinatorRegistry contract event you would like to subscribe to.
* @param blockRange Block range to get logs from.
* @param indexFilterValues An object where the keys are indexed args returned by the event and
* the value is the value you are interested in. E.g `{_from: aUserAddressHex}`
* @return Array of logs that match the parameters
* @param eventName The CoordinatorRegistry contract event you would like to subscribe to.
* @param blockRange Block range to get logs from.
* @param indexFilterValues An object where the keys are indexed args returned by the event and
* the value is the value you are interested in. E.g `{_from: aUserAddressHex}`
* @return Array of logs that match the parameters
*/
public async getLogsAsync<ArgsType extends CoordinatorRegistryEventArgs>(
eventName: CoordinatorRegistryEvents,

View File

@@ -55,6 +55,11 @@ export interface DummyERC20TokenApprovalEventArgs extends DecodedLogArgs {
// tslint:disable-next-line:class-name
export class DummyERC20TokenContract extends BaseContract {
public name = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
*/
async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<string> {
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
schemas.addressSchema,
@@ -86,13 +91,43 @@ export class DummyERC20TokenContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(): string {
const self = (this as any) as DummyERC20TokenContract;
const abiEncodedTransactionData = self._strictEncodeArguments('name()', []);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): string {
const self = (this as any) as DummyERC20TokenContract;
const abiEncoder = self._lookupAbiEncoder('name()');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<string>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): string {
const self = (this as any) as DummyERC20TokenContract;
const abiEncoder = self._lookupAbiEncoder('name()');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<string>(returnData);
return abiDecodedReturnData;
},
};
/**
* `msg.sender` approves `_spender` to spend `_value` tokens
*/
public approve = {
/**
* Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write
* Ethereum operation and will cost gas.
* @param _spender The address of the account able to transfer the tokens
* @param _value The amount of wei to be approved for transfer
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async sendTransactionAsync(
_spender: string,
_value: BigNumber,
@@ -121,6 +156,15 @@ export class DummyERC20TokenContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
/**
* Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting.
* If the transaction was mined, but reverted, an error is thrown.
* @param _spender The address of the account able to transfer the tokens
* @param _value The amount of wei to be approved for transfer
* @param txData Additional data for transaction
* @param pollingIntervalMs Interval at which to poll for success
* @returns A promise that resolves when the transaction is successful
*/
awaitTransactionSuccessAsync(
_spender: string,
_value: BigNumber,
@@ -144,6 +188,13 @@ export class DummyERC20TokenContract extends BaseContract {
})(),
);
},
/**
* Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments.
* @param _spender The address of the account able to transfer the tokens
* @param _value The amount of wei to be approved for transfer
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async estimateGasAsync(
_spender: string,
_value: BigNumber,
@@ -171,6 +222,14 @@ export class DummyERC20TokenContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @param _spender The address of the account able to transfer the tokens
* @param _value The amount of wei to be approved for transfer
* @returns Always true if the call has enough gas to complete execution
*/
async callAsync(
_spender: string,
_value: BigNumber,
@@ -212,6 +271,13 @@ export class DummyERC20TokenContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
* @param _spender The address of the account able to transfer the tokens
* @param _value The amount of wei to be approved for transfer
*/
getABIEncodedTransactionData(_spender: string, _value: BigNumber): string {
assert.isString('_spender', _spender);
assert.isBigNumber('_value', _value);
@@ -222,8 +288,31 @@ export class DummyERC20TokenContract extends BaseContract {
]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): boolean {
const self = (this as any) as DummyERC20TokenContract;
const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<boolean>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): boolean {
const self = (this as any) as DummyERC20TokenContract;
const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<boolean>(returnData);
return abiDecodedReturnData;
},
};
/**
* Query total supply of token
*/
public totalSupply = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @returns Total supply of token
*/
async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<BigNumber> {
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
schemas.addressSchema,
@@ -255,13 +344,44 @@ export class DummyERC20TokenContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(): string {
const self = (this as any) as DummyERC20TokenContract;
const abiEncodedTransactionData = self._strictEncodeArguments('totalSupply()', []);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): BigNumber {
const self = (this as any) as DummyERC20TokenContract;
const abiEncoder = self._lookupAbiEncoder('totalSupply()');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<BigNumber>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): BigNumber {
const self = (this as any) as DummyERC20TokenContract;
const abiEncoder = self._lookupAbiEncoder('totalSupply()');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<BigNumber>(returnData);
return abiDecodedReturnData;
},
};
/**
* ERC20 transferFrom, modified such that an allowance of MAX_UINT represents an unlimited allowance. See https://github.com/ethereum/EIPs/issues/717
*/
public transferFrom = {
/**
* Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write
* Ethereum operation and will cost gas.
* @param _from Address to transfer from.
* @param _to Address to transfer to.
* @param _value Amount to transfer.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async sendTransactionAsync(
_from: string,
_to: string,
@@ -293,6 +413,16 @@ export class DummyERC20TokenContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
/**
* Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting.
* If the transaction was mined, but reverted, an error is thrown.
* @param _from Address to transfer from.
* @param _to Address to transfer to.
* @param _value Amount to transfer.
* @param txData Additional data for transaction
* @param pollingIntervalMs Interval at which to poll for success
* @returns A promise that resolves when the transaction is successful
*/
awaitTransactionSuccessAsync(
_from: string,
_to: string,
@@ -323,6 +453,14 @@ export class DummyERC20TokenContract extends BaseContract {
})(),
);
},
/**
* Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments.
* @param _from Address to transfer from.
* @param _to Address to transfer to.
* @param _value Amount to transfer.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async estimateGasAsync(
_from: string,
_to: string,
@@ -353,6 +491,15 @@ export class DummyERC20TokenContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @param _from Address to transfer from.
* @param _to Address to transfer to.
* @param _value Amount to transfer.
* @returns Success of transfer.
*/
async callAsync(
_from: string,
_to: string,
@@ -397,6 +544,14 @@ export class DummyERC20TokenContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
* @param _from Address to transfer from.
* @param _to Address to transfer to.
* @param _value Amount to transfer.
*/
getABIEncodedTransactionData(_from: string, _to: string, _value: BigNumber): string {
assert.isString('_from', _from);
assert.isString('_to', _to);
@@ -409,8 +564,27 @@ export class DummyERC20TokenContract extends BaseContract {
]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): boolean {
const self = (this as any) as DummyERC20TokenContract;
const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<boolean>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): boolean {
const self = (this as any) as DummyERC20TokenContract;
const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<boolean>(returnData);
return abiDecodedReturnData;
},
};
public decimals = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
*/
async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<BigNumber> {
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
schemas.addressSchema,
@@ -442,13 +616,42 @@ export class DummyERC20TokenContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(): string {
const self = (this as any) as DummyERC20TokenContract;
const abiEncodedTransactionData = self._strictEncodeArguments('decimals()', []);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): BigNumber {
const self = (this as any) as DummyERC20TokenContract;
const abiEncoder = self._lookupAbiEncoder('decimals()');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<BigNumber>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): BigNumber {
const self = (this as any) as DummyERC20TokenContract;
const abiEncoder = self._lookupAbiEncoder('decimals()');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<BigNumber>(returnData);
return abiDecodedReturnData;
},
};
/**
* Query the balance of owner
*/
public balanceOf = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @param _owner The address from which the balance will be retrieved
* @returns Balance of owner
*/
async callAsync(
_owner: string,
callData: Partial<CallData> = {},
@@ -485,14 +688,39 @@ export class DummyERC20TokenContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
* @param _owner The address from which the balance will be retrieved
*/
getABIEncodedTransactionData(_owner: string): string {
assert.isString('_owner', _owner);
const self = (this as any) as DummyERC20TokenContract;
const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): BigNumber {
const self = (this as any) as DummyERC20TokenContract;
const abiEncoder = self._lookupAbiEncoder('balanceOf(address)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<BigNumber>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): BigNumber {
const self = (this as any) as DummyERC20TokenContract;
const abiEncoder = self._lookupAbiEncoder('balanceOf(address)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<BigNumber>(returnData);
return abiDecodedReturnData;
},
};
public owner = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
*/
async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<string> {
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
schemas.addressSchema,
@@ -524,13 +752,37 @@ export class DummyERC20TokenContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(): string {
const self = (this as any) as DummyERC20TokenContract;
const abiEncodedTransactionData = self._strictEncodeArguments('owner()', []);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): string {
const self = (this as any) as DummyERC20TokenContract;
const abiEncoder = self._lookupAbiEncoder('owner()');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<string>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): string {
const self = (this as any) as DummyERC20TokenContract;
const abiEncoder = self._lookupAbiEncoder('owner()');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<string>(returnData);
return abiDecodedReturnData;
},
};
public symbol = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
*/
async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<string> {
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
schemas.addressSchema,
@@ -562,13 +814,42 @@ export class DummyERC20TokenContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(): string {
const self = (this as any) as DummyERC20TokenContract;
const abiEncodedTransactionData = self._strictEncodeArguments('symbol()', []);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): string {
const self = (this as any) as DummyERC20TokenContract;
const abiEncoder = self._lookupAbiEncoder('symbol()');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<string>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): string {
const self = (this as any) as DummyERC20TokenContract;
const abiEncoder = self._lookupAbiEncoder('symbol()');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<string>(returnData);
return abiDecodedReturnData;
},
};
/**
* Mints new tokens for sender
*/
public mint = {
/**
* Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write
* Ethereum operation and will cost gas.
* @param _value Amount of tokens to mint
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async sendTransactionAsync(_value: BigNumber, txData?: Partial<TxData> | undefined): Promise<string> {
assert.isBigNumber('_value', _value);
const self = (this as any) as DummyERC20TokenContract;
@@ -589,6 +870,14 @@ export class DummyERC20TokenContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
/**
* Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting.
* If the transaction was mined, but reverted, an error is thrown.
* @param _value Amount of tokens to mint
* @param txData Additional data for transaction
* @param pollingIntervalMs Interval at which to poll for success
* @returns A promise that resolves when the transaction is successful
*/
awaitTransactionSuccessAsync(
_value: BigNumber,
txData?: Partial<TxData>,
@@ -610,6 +899,12 @@ export class DummyERC20TokenContract extends BaseContract {
})(),
);
},
/**
* Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments.
* @param _value Amount of tokens to mint
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async estimateGasAsync(_value: BigNumber, txData?: Partial<TxData> | undefined): Promise<number> {
assert.isBigNumber('_value', _value);
const self = (this as any) as DummyERC20TokenContract;
@@ -629,6 +924,12 @@ export class DummyERC20TokenContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @param _value Amount of tokens to mint
*/
async callAsync(_value: BigNumber, callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<void> {
assert.isBigNumber('_value', _value);
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
@@ -661,14 +962,45 @@ export class DummyERC20TokenContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
* @param _value Amount of tokens to mint
*/
getABIEncodedTransactionData(_value: BigNumber): string {
assert.isBigNumber('_value', _value);
const self = (this as any) as DummyERC20TokenContract;
const abiEncodedTransactionData = self._strictEncodeArguments('mint(uint256)', [_value]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): void {
const self = (this as any) as DummyERC20TokenContract;
const abiEncoder = self._lookupAbiEncoder('mint(uint256)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<void>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): void {
const self = (this as any) as DummyERC20TokenContract;
const abiEncoder = self._lookupAbiEncoder('mint(uint256)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
};
/**
* send `value` token to `to` from `msg.sender`
*/
public transfer = {
/**
* Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write
* Ethereum operation and will cost gas.
* @param _to The address of the recipient
* @param _value The amount of token to be transferred
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async sendTransactionAsync(
_to: string,
_value: BigNumber,
@@ -694,6 +1026,15 @@ export class DummyERC20TokenContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
/**
* Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting.
* If the transaction was mined, but reverted, an error is thrown.
* @param _to The address of the recipient
* @param _value The amount of token to be transferred
* @param txData Additional data for transaction
* @param pollingIntervalMs Interval at which to poll for success
* @returns A promise that resolves when the transaction is successful
*/
awaitTransactionSuccessAsync(
_to: string,
_value: BigNumber,
@@ -717,6 +1058,13 @@ export class DummyERC20TokenContract extends BaseContract {
})(),
);
},
/**
* Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments.
* @param _to The address of the recipient
* @param _value The amount of token to be transferred
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async estimateGasAsync(_to: string, _value: BigNumber, txData?: Partial<TxData> | undefined): Promise<number> {
assert.isString('_to', _to);
assert.isBigNumber('_value', _value);
@@ -737,6 +1085,14 @@ export class DummyERC20TokenContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @param _to The address of the recipient
* @param _value The amount of token to be transferred
* @returns True if transfer was successful
*/
async callAsync(
_to: string,
_value: BigNumber,
@@ -775,6 +1131,13 @@ export class DummyERC20TokenContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
* @param _to The address of the recipient
* @param _value The amount of token to be transferred
*/
getABIEncodedTransactionData(_to: string, _value: BigNumber): string {
assert.isString('_to', _to);
assert.isBigNumber('_value', _value);
@@ -785,8 +1148,30 @@ export class DummyERC20TokenContract extends BaseContract {
]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): boolean {
const self = (this as any) as DummyERC20TokenContract;
const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<boolean>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): boolean {
const self = (this as any) as DummyERC20TokenContract;
const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<boolean>(returnData);
return abiDecodedReturnData;
},
};
public allowance = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @param _owner The address of the account owning tokens
* @param _spender The address of the account able to transfer the tokens
* @returns Amount of remaining tokens allowed to spent
*/
async callAsync(
_owner: string,
_spender: string,
@@ -828,6 +1213,13 @@ export class DummyERC20TokenContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
* @param _owner The address of the account owning tokens
* @param _spender The address of the account able to transfer the tokens
*/
getABIEncodedTransactionData(_owner: string, _spender: string): string {
assert.isString('_owner', _owner);
assert.isString('_spender', _spender);
@@ -838,8 +1230,33 @@ export class DummyERC20TokenContract extends BaseContract {
]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): BigNumber {
const self = (this as any) as DummyERC20TokenContract;
const abiEncoder = self._lookupAbiEncoder('allowance(address,address)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<BigNumber>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): BigNumber {
const self = (this as any) as DummyERC20TokenContract;
const abiEncoder = self._lookupAbiEncoder('allowance(address,address)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<BigNumber>(returnData);
return abiDecodedReturnData;
},
};
/**
* Sets the balance of target address
*/
public setBalance = {
/**
* Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write
* Ethereum operation and will cost gas.
* @param _target Address or which balance will be updated
* @param _value New balance of target address
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async sendTransactionAsync(
_target: string,
_value: BigNumber,
@@ -868,6 +1285,15 @@ export class DummyERC20TokenContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
/**
* Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting.
* If the transaction was mined, but reverted, an error is thrown.
* @param _target Address or which balance will be updated
* @param _value New balance of target address
* @param txData Additional data for transaction
* @param pollingIntervalMs Interval at which to poll for success
* @returns A promise that resolves when the transaction is successful
*/
awaitTransactionSuccessAsync(
_target: string,
_value: BigNumber,
@@ -891,6 +1317,13 @@ export class DummyERC20TokenContract extends BaseContract {
})(),
);
},
/**
* Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments.
* @param _target Address or which balance will be updated
* @param _value New balance of target address
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async estimateGasAsync(
_target: string,
_value: BigNumber,
@@ -918,6 +1351,13 @@ export class DummyERC20TokenContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @param _target Address or which balance will be updated
* @param _value New balance of target address
*/
async callAsync(
_target: string,
_value: BigNumber,
@@ -959,6 +1399,13 @@ export class DummyERC20TokenContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
* @param _target Address or which balance will be updated
* @param _value New balance of target address
*/
getABIEncodedTransactionData(_target: string, _value: BigNumber): string {
assert.isString('_target', _target);
assert.isBigNumber('_value', _value);
@@ -969,8 +1416,28 @@ export class DummyERC20TokenContract extends BaseContract {
]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): void {
const self = (this as any) as DummyERC20TokenContract;
const abiEncoder = self._lookupAbiEncoder('setBalance(address,uint256)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<void>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): void {
const self = (this as any) as DummyERC20TokenContract;
const abiEncoder = self._lookupAbiEncoder('setBalance(address,uint256)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
};
public transferOwnership = {
/**
* Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write
* Ethereum operation and will cost gas.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async sendTransactionAsync(newOwner: string, txData?: Partial<TxData> | undefined): Promise<string> {
assert.isString('newOwner', newOwner);
const self = (this as any) as DummyERC20TokenContract;
@@ -991,6 +1458,13 @@ export class DummyERC20TokenContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
/**
* Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting.
* If the transaction was mined, but reverted, an error is thrown.
* @param txData Additional data for transaction
* @param pollingIntervalMs Interval at which to poll for success
* @returns A promise that resolves when the transaction is successful
*/
awaitTransactionSuccessAsync(
newOwner: string,
txData?: Partial<TxData>,
@@ -1012,6 +1486,11 @@ export class DummyERC20TokenContract extends BaseContract {
})(),
);
},
/**
* Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async estimateGasAsync(newOwner: string, txData?: Partial<TxData> | undefined): Promise<number> {
assert.isString('newOwner', newOwner);
const self = (this as any) as DummyERC20TokenContract;
@@ -1031,6 +1510,11 @@ export class DummyERC20TokenContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
*/
async callAsync(newOwner: string, callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<void> {
assert.isString('newOwner', newOwner);
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
@@ -1063,6 +1547,11 @@ export class DummyERC20TokenContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(newOwner: string): string {
assert.isString('newOwner', newOwner);
const self = (this as any) as DummyERC20TokenContract;
@@ -1071,8 +1560,27 @@ export class DummyERC20TokenContract extends BaseContract {
]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): void {
const self = (this as any) as DummyERC20TokenContract;
const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<void>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): void {
const self = (this as any) as DummyERC20TokenContract;
const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
};
public MAX_MINT_AMOUNT = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
*/
async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<BigNumber> {
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
schemas.addressSchema,
@@ -1104,11 +1612,30 @@ export class DummyERC20TokenContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(): string {
const self = (this as any) as DummyERC20TokenContract;
const abiEncodedTransactionData = self._strictEncodeArguments('MAX_MINT_AMOUNT()', []);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): BigNumber {
const self = (this as any) as DummyERC20TokenContract;
const abiEncoder = self._lookupAbiEncoder('MAX_MINT_AMOUNT()');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<BigNumber>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): BigNumber {
const self = (this as any) as DummyERC20TokenContract;
const abiEncoder = self._lookupAbiEncoder('MAX_MINT_AMOUNT()');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<BigNumber>(returnData);
return abiDecodedReturnData;
},
};
private readonly _subscriptionManager: SubscriptionManager<DummyERC20TokenEventArgs, DummyERC20TokenEvents>;
public static async deployFrom0xArtifactAsync(
@@ -1133,8 +1660,10 @@ export class DummyERC20TokenContract extends BaseContract {
const bytecode = artifact.compilerOutput.evm.bytecode.object;
const abi = artifact.compilerOutput.abi;
const logDecodeDependenciesAbiOnly: { [contractName: string]: ContractAbi } = {};
for (const key of Object.keys(logDecodeDependencies)) {
logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi;
if (Object.keys(logDecodeDependencies) !== undefined) {
for (const key of Object.keys(logDecodeDependencies)) {
logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi;
}
}
return DummyERC20TokenContract.deployAsync(
bytecode,
@@ -1520,11 +2049,11 @@ export class DummyERC20TokenContract extends BaseContract {
}
/**
* Subscribe to an event type emitted by the DummyERC20Token contract.
* @param eventName The DummyERC20Token contract event you would like to subscribe to.
* @param indexFilterValues An object where the keys are indexed args returned by the event and
* the value is the value you are interested in. E.g `{maker: aUserAddressHex}`
* @param callback Callback that gets called when a log is added/removed
* @param isVerbose Enable verbose subscription warnings (e.g recoverable network issues encountered)
* @param eventName The DummyERC20Token contract event you would like to subscribe to.
* @param indexFilterValues An object where the keys are indexed args returned by the event and
* the value is the value you are interested in. E.g `{maker: aUserAddressHex}`
* @param callback Callback that gets called when a log is added/removed
* @param isVerbose Enable verbose subscription warnings (e.g recoverable network issues encountered)
* @return Subscription token used later to unsubscribe
*/
public subscribe<ArgsType extends DummyERC20TokenEventArgs>(
@@ -1550,7 +2079,7 @@ export class DummyERC20TokenContract extends BaseContract {
}
/**
* Cancel a subscription
* @param subscriptionToken Subscription token returned by `subscribe()`
* @param subscriptionToken Subscription token returned by `subscribe()`
*/
public unsubscribe(subscriptionToken: string): void {
this._subscriptionManager.unsubscribe(subscriptionToken);
@@ -1563,11 +2092,11 @@ export class DummyERC20TokenContract extends BaseContract {
}
/**
* Gets historical logs without creating a subscription
* @param eventName The DummyERC20Token contract event you would like to subscribe to.
* @param blockRange Block range to get logs from.
* @param indexFilterValues An object where the keys are indexed args returned by the event and
* the value is the value you are interested in. E.g `{_from: aUserAddressHex}`
* @return Array of logs that match the parameters
* @param eventName The DummyERC20Token contract event you would like to subscribe to.
* @param blockRange Block range to get logs from.
* @param indexFilterValues An object where the keys are indexed args returned by the event and
* the value is the value you are interested in. E.g `{_from: aUserAddressHex}`
* @return Array of logs that match the parameters
*/
public async getLogsAsync<ArgsType extends DummyERC20TokenEventArgs>(
eventName: DummyERC20TokenEvents,

File diff suppressed because it is too large Load Diff

View File

@@ -27,7 +27,17 @@ import * as ethers from 'ethers';
// tslint:disable:no-parameter-reassignment
// tslint:disable-next-line:class-name
export class DutchAuctionContract extends BaseContract {
/**
* Calculates the Auction Details for the given order
*/
public getAuctionDetails = {
/**
* Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write
* Ethereum operation and will cost gas.
* @param order The sell order
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async sendTransactionAsync(
order: {
makerAddress: string;
@@ -66,6 +76,14 @@ export class DutchAuctionContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
/**
* Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting.
* If the transaction was mined, but reverted, an error is thrown.
* @param order The sell order
* @param txData Additional data for transaction
* @param pollingIntervalMs Interval at which to poll for success
* @returns A promise that resolves when the transaction is successful
*/
awaitTransactionSuccessAsync(
order: {
makerAddress: string;
@@ -99,6 +117,12 @@ export class DutchAuctionContract extends BaseContract {
})(),
);
},
/**
* Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments.
* @param order The sell order
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async estimateGasAsync(
order: {
makerAddress: string;
@@ -136,6 +160,13 @@ export class DutchAuctionContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @param order The sell order
* @returns AuctionDetails
*/
async callAsync(
order: {
makerAddress: string;
@@ -203,6 +234,12 @@ export class DutchAuctionContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
* @param order The sell order
*/
getABIEncodedTransactionData(order: {
makerAddress: string;
takerAddress: string;
@@ -224,8 +261,87 @@ export class DutchAuctionContract extends BaseContract {
);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(
callData: string,
): {
beginTimeSeconds: BigNumber;
endTimeSeconds: BigNumber;
beginAmount: BigNumber;
endAmount: BigNumber;
currentAmount: BigNumber;
currentTimeSeconds: BigNumber;
} {
const self = (this as any) as DutchAuctionContract;
const abiEncoder = self._lookupAbiEncoder(
'getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))',
);
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<{
beginTimeSeconds: BigNumber;
endTimeSeconds: BigNumber;
beginAmount: BigNumber;
endAmount: BigNumber;
currentAmount: BigNumber;
currentTimeSeconds: BigNumber;
}>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(
returnData: string,
): {
beginTimeSeconds: BigNumber;
endTimeSeconds: BigNumber;
beginAmount: BigNumber;
endAmount: BigNumber;
currentAmount: BigNumber;
currentTimeSeconds: BigNumber;
} {
const self = (this as any) as DutchAuctionContract;
const abiEncoder = self._lookupAbiEncoder(
'getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))',
);
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<{
beginTimeSeconds: BigNumber;
endTimeSeconds: BigNumber;
beginAmount: BigNumber;
endAmount: BigNumber;
currentAmount: BigNumber;
currentTimeSeconds: BigNumber;
}>(returnData);
return abiDecodedReturnData;
},
};
/**
* Matches the buy and sell orders at an amount given the following: the current block time, the auction
* start time and the auction begin amount. The sell order is a an order at the lowest amount
* at the end of the auction. Excess from the match is transferred to the seller.
* Over time the price moves from beginAmount to endAmount given the current block.timestamp.
* sellOrder.expiryTimeSeconds is the end time of the auction.
* sellOrder.takerAssetAmount is the end amount of the auction (lowest possible amount).
* sellOrder.makerAssetData is the ABI encoded Asset Proxy data with the following data appended
* buyOrder.makerAssetData is the buyers bid on the auction, must meet the amount for the current block timestamp
* (uint256 beginTimeSeconds, uint256 beginAmount).
* This function reverts in the following scenarios:
* * Auction has not started (auctionDetails.currentTimeSeconds < auctionDetails.beginTimeSeconds)
* * Auction has expired (auctionDetails.endTimeSeconds < auctionDetails.currentTimeSeconds)
* * Amount is invalid: Buy order amount is too low (buyOrder.makerAssetAmount < auctionDetails.currentAmount)
* * Amount is invalid: Invalid begin amount (auctionDetails.beginAmount > auctionDetails.endAmount)
* * Any failure in the 0x Match Orders
*/
public matchOrders = {
/**
* Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write
* Ethereum operation and will cost gas.
* @param buyOrder The Buyer's order. This order is for the current expected
* price of the auction.
* @param sellOrder The Seller's order. This order is for the lowest amount (at
* the end of the auction).
* @param buySignature Proof that order was created by the buyer.
* @param sellSignature Proof that order was created by the seller.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async sendTransactionAsync(
buyOrder: {
makerAddress: string;
@@ -282,6 +398,19 @@ export class DutchAuctionContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
/**
* Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting.
* If the transaction was mined, but reverted, an error is thrown.
* @param buyOrder The Buyer's order. This order is for the current expected
* price of the auction.
* @param sellOrder The Seller's order. This order is for the lowest amount (at
* the end of the auction).
* @param buySignature Proof that order was created by the buyer.
* @param sellSignature Proof that order was created by the seller.
* @param txData Additional data for transaction
* @param pollingIntervalMs Interval at which to poll for success
* @returns A promise that resolves when the transaction is successful
*/
awaitTransactionSuccessAsync(
buyOrder: {
makerAddress: string;
@@ -339,6 +468,17 @@ export class DutchAuctionContract extends BaseContract {
})(),
);
},
/**
* Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments.
* @param buyOrder The Buyer's order. This order is for the current expected
* price of the auction.
* @param sellOrder The Seller's order. This order is for the lowest amount (at
* the end of the auction).
* @param buySignature Proof that order was created by the buyer.
* @param sellSignature Proof that order was created by the seller.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async estimateGasAsync(
buyOrder: {
makerAddress: string;
@@ -394,6 +534,18 @@ export class DutchAuctionContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @param buyOrder The Buyer's order. This order is for the current expected
* price of the auction.
* @param sellOrder The Seller's order. This order is for the lowest amount (at
* the end of the auction).
* @param buySignature Proof that order was created by the buyer.
* @param sellSignature Proof that order was created by the seller.
* @returns matchedFillResults amounts filled and fees paid by maker and taker of matched orders.
*/
async callAsync(
buyOrder: {
makerAddress: string;
@@ -493,6 +645,17 @@ export class DutchAuctionContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
* @param buyOrder The Buyer's order. This order is for the current expected
* price of the auction.
* @param sellOrder The Seller's order. This order is for the lowest amount (at
* the end of the auction).
* @param buySignature Proof that order was created by the buyer.
* @param sellSignature Proof that order was created by the seller.
*/
getABIEncodedTransactionData(
buyOrder: {
makerAddress: string;
@@ -534,6 +697,84 @@ export class DutchAuctionContract extends BaseContract {
);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(
callData: string,
): {
left: {
makerAssetFilledAmount: BigNumber;
takerAssetFilledAmount: BigNumber;
makerFeePaid: BigNumber;
takerFeePaid: BigNumber;
};
right: {
makerAssetFilledAmount: BigNumber;
takerAssetFilledAmount: BigNumber;
makerFeePaid: BigNumber;
takerFeePaid: BigNumber;
};
leftMakerAssetSpreadAmount: BigNumber;
} {
const self = (this as any) as DutchAuctionContract;
const abiEncoder = self._lookupAbiEncoder(
'matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)',
);
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<{
left: {
makerAssetFilledAmount: BigNumber;
takerAssetFilledAmount: BigNumber;
makerFeePaid: BigNumber;
takerFeePaid: BigNumber;
};
right: {
makerAssetFilledAmount: BigNumber;
takerAssetFilledAmount: BigNumber;
makerFeePaid: BigNumber;
takerFeePaid: BigNumber;
};
leftMakerAssetSpreadAmount: BigNumber;
}>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(
returnData: string,
): {
left: {
makerAssetFilledAmount: BigNumber;
takerAssetFilledAmount: BigNumber;
makerFeePaid: BigNumber;
takerFeePaid: BigNumber;
};
right: {
makerAssetFilledAmount: BigNumber;
takerAssetFilledAmount: BigNumber;
makerFeePaid: BigNumber;
takerFeePaid: BigNumber;
};
leftMakerAssetSpreadAmount: BigNumber;
} {
const self = (this as any) as DutchAuctionContract;
const abiEncoder = self._lookupAbiEncoder(
'matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)',
);
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<{
left: {
makerAssetFilledAmount: BigNumber;
takerAssetFilledAmount: BigNumber;
makerFeePaid: BigNumber;
takerFeePaid: BigNumber;
};
right: {
makerAssetFilledAmount: BigNumber;
takerAssetFilledAmount: BigNumber;
makerFeePaid: BigNumber;
takerFeePaid: BigNumber;
};
leftMakerAssetSpreadAmount: BigNumber;
}>(returnData);
return abiDecodedReturnData;
},
};
public static async deployFrom0xArtifactAsync(
artifact: ContractArtifact | SimpleContractArtifact,
@@ -554,8 +795,10 @@ export class DutchAuctionContract extends BaseContract {
const bytecode = artifact.compilerOutput.evm.bytecode.object;
const abi = artifact.compilerOutput.abi;
const logDecodeDependenciesAbiOnly: { [contractName: string]: ContractAbi } = {};
for (const key of Object.keys(logDecodeDependencies)) {
logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi;
if (Object.keys(logDecodeDependencies) !== undefined) {
for (const key of Object.keys(logDecodeDependencies)) {
logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi;
}
}
return DutchAuctionContract.deployAsync(
bytecode,

View File

@@ -54,7 +54,17 @@ export interface ERC20ProxyAuthorizedAddressRemovedEventArgs extends DecodedLogA
// tslint:disable:no-parameter-reassignment
// tslint:disable-next-line:class-name
export class ERC20ProxyContract extends BaseContract {
/**
* Authorizes an address.
*/
public addAuthorizedAddress = {
/**
* Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write
* Ethereum operation and will cost gas.
* @param target Address to authorize.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async sendTransactionAsync(target: string, txData?: Partial<TxData> | undefined): Promise<string> {
assert.isString('target', target);
const self = (this as any) as ERC20ProxyContract;
@@ -75,6 +85,14 @@ export class ERC20ProxyContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
/**
* Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting.
* If the transaction was mined, but reverted, an error is thrown.
* @param target Address to authorize.
* @param txData Additional data for transaction
* @param pollingIntervalMs Interval at which to poll for success
* @returns A promise that resolves when the transaction is successful
*/
awaitTransactionSuccessAsync(
target: string,
txData?: Partial<TxData>,
@@ -96,6 +114,12 @@ export class ERC20ProxyContract extends BaseContract {
})(),
);
},
/**
* Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments.
* @param target Address to authorize.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async estimateGasAsync(target: string, txData?: Partial<TxData> | undefined): Promise<number> {
assert.isString('target', target);
const self = (this as any) as ERC20ProxyContract;
@@ -115,6 +139,12 @@ export class ERC20ProxyContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @param target Address to authorize.
*/
async callAsync(target: string, callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<void> {
assert.isString('target', target);
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
@@ -147,6 +177,12 @@ export class ERC20ProxyContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
* @param target Address to authorize.
*/
getABIEncodedTransactionData(target: string): string {
assert.isString('target', target);
const self = (this as any) as ERC20ProxyContract;
@@ -155,8 +191,27 @@ export class ERC20ProxyContract extends BaseContract {
]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): void {
const self = (this as any) as ERC20ProxyContract;
const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<void>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): void {
const self = (this as any) as ERC20ProxyContract;
const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
};
public authorities = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
*/
async callAsync(
index_0: BigNumber,
callData: Partial<CallData> = {},
@@ -193,14 +248,43 @@ export class ERC20ProxyContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(index_0: BigNumber): string {
assert.isBigNumber('index_0', index_0);
const self = (this as any) as ERC20ProxyContract;
const abiEncodedTransactionData = self._strictEncodeArguments('authorities(uint256)', [index_0]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): string {
const self = (this as any) as ERC20ProxyContract;
const abiEncoder = self._lookupAbiEncoder('authorities(uint256)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<string>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): string {
const self = (this as any) as ERC20ProxyContract;
const abiEncoder = self._lookupAbiEncoder('authorities(uint256)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<string>(returnData);
return abiDecodedReturnData;
},
};
/**
* Removes authorizion of an address.
*/
public removeAuthorizedAddress = {
/**
* Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write
* Ethereum operation and will cost gas.
* @param target Address to remove authorization from.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async sendTransactionAsync(target: string, txData?: Partial<TxData> | undefined): Promise<string> {
assert.isString('target', target);
const self = (this as any) as ERC20ProxyContract;
@@ -221,6 +305,14 @@ export class ERC20ProxyContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
/**
* Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting.
* If the transaction was mined, but reverted, an error is thrown.
* @param target Address to remove authorization from.
* @param txData Additional data for transaction
* @param pollingIntervalMs Interval at which to poll for success
* @returns A promise that resolves when the transaction is successful
*/
awaitTransactionSuccessAsync(
target: string,
txData?: Partial<TxData>,
@@ -242,6 +334,12 @@ export class ERC20ProxyContract extends BaseContract {
})(),
);
},
/**
* Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments.
* @param target Address to remove authorization from.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async estimateGasAsync(target: string, txData?: Partial<TxData> | undefined): Promise<number> {
assert.isString('target', target);
const self = (this as any) as ERC20ProxyContract;
@@ -261,6 +359,12 @@ export class ERC20ProxyContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @param target Address to remove authorization from.
*/
async callAsync(target: string, callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<void> {
assert.isString('target', target);
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
@@ -293,6 +397,12 @@ export class ERC20ProxyContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
* @param target Address to remove authorization from.
*/
getABIEncodedTransactionData(target: string): string {
assert.isString('target', target);
const self = (this as any) as ERC20ProxyContract;
@@ -301,8 +411,27 @@ export class ERC20ProxyContract extends BaseContract {
]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): void {
const self = (this as any) as ERC20ProxyContract;
const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<void>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): void {
const self = (this as any) as ERC20ProxyContract;
const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
};
public owner = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
*/
async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<string> {
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
schemas.addressSchema,
@@ -334,13 +463,43 @@ export class ERC20ProxyContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(): string {
const self = (this as any) as ERC20ProxyContract;
const abiEncodedTransactionData = self._strictEncodeArguments('owner()', []);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): string {
const self = (this as any) as ERC20ProxyContract;
const abiEncoder = self._lookupAbiEncoder('owner()');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<string>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): string {
const self = (this as any) as ERC20ProxyContract;
const abiEncoder = self._lookupAbiEncoder('owner()');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<string>(returnData);
return abiDecodedReturnData;
},
};
/**
* Removes authorizion of an address.
*/
public removeAuthorizedAddressAtIndex = {
/**
* Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write
* Ethereum operation and will cost gas.
* @param target Address to remove authorization from.
* @param index Index of target in authorities array.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async sendTransactionAsync(
target: string,
index: BigNumber,
@@ -369,6 +528,15 @@ export class ERC20ProxyContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
/**
* Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting.
* If the transaction was mined, but reverted, an error is thrown.
* @param target Address to remove authorization from.
* @param index Index of target in authorities array.
* @param txData Additional data for transaction
* @param pollingIntervalMs Interval at which to poll for success
* @returns A promise that resolves when the transaction is successful
*/
awaitTransactionSuccessAsync(
target: string,
index: BigNumber,
@@ -396,6 +564,13 @@ export class ERC20ProxyContract extends BaseContract {
})(),
);
},
/**
* Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments.
* @param target Address to remove authorization from.
* @param index Index of target in authorities array.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async estimateGasAsync(
target: string,
index: BigNumber,
@@ -423,6 +598,13 @@ export class ERC20ProxyContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @param target Address to remove authorization from.
* @param index Index of target in authorities array.
*/
async callAsync(
target: string,
index: BigNumber,
@@ -464,6 +646,13 @@ export class ERC20ProxyContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
* @param target Address to remove authorization from.
* @param index Index of target in authorities array.
*/
getABIEncodedTransactionData(target: string, index: BigNumber): string {
assert.isString('target', target);
assert.isBigNumber('index', index);
@@ -474,8 +663,31 @@ export class ERC20ProxyContract extends BaseContract {
);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): void {
const self = (this as any) as ERC20ProxyContract;
const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<void>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): void {
const self = (this as any) as ERC20ProxyContract;
const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
};
/**
* Gets the proxy id associated with the proxy address.
*/
public getProxyId = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @returns Proxy id.
*/
async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<string> {
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
schemas.addressSchema,
@@ -507,13 +719,37 @@ export class ERC20ProxyContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(): string {
const self = (this as any) as ERC20ProxyContract;
const abiEncodedTransactionData = self._strictEncodeArguments('getProxyId()', []);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): string {
const self = (this as any) as ERC20ProxyContract;
const abiEncoder = self._lookupAbiEncoder('getProxyId()');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<string>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): string {
const self = (this as any) as ERC20ProxyContract;
const abiEncoder = self._lookupAbiEncoder('getProxyId()');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<string>(returnData);
return abiDecodedReturnData;
},
};
public authorized = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
*/
async callAsync(
index_0: string,
callData: Partial<CallData> = {},
@@ -550,6 +786,11 @@ export class ERC20ProxyContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(index_0: string): string {
assert.isString('index_0', index_0);
const self = (this as any) as ERC20ProxyContract;
@@ -558,8 +799,31 @@ export class ERC20ProxyContract extends BaseContract {
]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): boolean {
const self = (this as any) as ERC20ProxyContract;
const abiEncoder = self._lookupAbiEncoder('authorized(address)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<boolean>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): boolean {
const self = (this as any) as ERC20ProxyContract;
const abiEncoder = self._lookupAbiEncoder('authorized(address)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<boolean>(returnData);
return abiDecodedReturnData;
},
};
/**
* Gets all authorized addresses.
*/
public getAuthorizedAddresses = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @returns Array of authorized addresses.
*/
async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<string[]> {
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
schemas.addressSchema,
@@ -591,13 +855,38 @@ export class ERC20ProxyContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(): string {
const self = (this as any) as ERC20ProxyContract;
const abiEncodedTransactionData = self._strictEncodeArguments('getAuthorizedAddresses()', []);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): string[] {
const self = (this as any) as ERC20ProxyContract;
const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<string[]>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): string[] {
const self = (this as any) as ERC20ProxyContract;
const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<string[]>(returnData);
return abiDecodedReturnData;
},
};
public transferOwnership = {
/**
* Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write
* Ethereum operation and will cost gas.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async sendTransactionAsync(newOwner: string, txData?: Partial<TxData> | undefined): Promise<string> {
assert.isString('newOwner', newOwner);
const self = (this as any) as ERC20ProxyContract;
@@ -618,6 +907,13 @@ export class ERC20ProxyContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
/**
* Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting.
* If the transaction was mined, but reverted, an error is thrown.
* @param txData Additional data for transaction
* @param pollingIntervalMs Interval at which to poll for success
* @returns A promise that resolves when the transaction is successful
*/
awaitTransactionSuccessAsync(
newOwner: string,
txData?: Partial<TxData>,
@@ -639,6 +935,11 @@ export class ERC20ProxyContract extends BaseContract {
})(),
);
},
/**
* Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async estimateGasAsync(newOwner: string, txData?: Partial<TxData> | undefined): Promise<number> {
assert.isString('newOwner', newOwner);
const self = (this as any) as ERC20ProxyContract;
@@ -658,6 +959,11 @@ export class ERC20ProxyContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
*/
async callAsync(newOwner: string, callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<void> {
assert.isString('newOwner', newOwner);
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
@@ -690,6 +996,11 @@ export class ERC20ProxyContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(newOwner: string): string {
assert.isString('newOwner', newOwner);
const self = (this as any) as ERC20ProxyContract;
@@ -698,6 +1009,20 @@ export class ERC20ProxyContract extends BaseContract {
]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): void {
const self = (this as any) as ERC20ProxyContract;
const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<void>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): void {
const self = (this as any) as ERC20ProxyContract;
const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
};
private readonly _subscriptionManager: SubscriptionManager<ERC20ProxyEventArgs, ERC20ProxyEvents>;
public static async deployFrom0xArtifactAsync(
@@ -718,8 +1043,10 @@ export class ERC20ProxyContract extends BaseContract {
const bytecode = artifact.compilerOutput.evm.bytecode.object;
const abi = artifact.compilerOutput.abi;
const logDecodeDependenciesAbiOnly: { [contractName: string]: ContractAbi } = {};
for (const key of Object.keys(logDecodeDependencies)) {
logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi;
if (Object.keys(logDecodeDependencies) !== undefined) {
for (const key of Object.keys(logDecodeDependencies)) {
logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi;
}
}
return ERC20ProxyContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly);
}
@@ -955,11 +1282,11 @@ export class ERC20ProxyContract extends BaseContract {
}
/**
* Subscribe to an event type emitted by the ERC20Proxy contract.
* @param eventName The ERC20Proxy contract event you would like to subscribe to.
* @param indexFilterValues An object where the keys are indexed args returned by the event and
* the value is the value you are interested in. E.g `{maker: aUserAddressHex}`
* @param callback Callback that gets called when a log is added/removed
* @param isVerbose Enable verbose subscription warnings (e.g recoverable network issues encountered)
* @param eventName The ERC20Proxy contract event you would like to subscribe to.
* @param indexFilterValues An object where the keys are indexed args returned by the event and
* the value is the value you are interested in. E.g `{maker: aUserAddressHex}`
* @param callback Callback that gets called when a log is added/removed
* @param isVerbose Enable verbose subscription warnings (e.g recoverable network issues encountered)
* @return Subscription token used later to unsubscribe
*/
public subscribe<ArgsType extends ERC20ProxyEventArgs>(
@@ -985,7 +1312,7 @@ export class ERC20ProxyContract extends BaseContract {
}
/**
* Cancel a subscription
* @param subscriptionToken Subscription token returned by `subscribe()`
* @param subscriptionToken Subscription token returned by `subscribe()`
*/
public unsubscribe(subscriptionToken: string): void {
this._subscriptionManager.unsubscribe(subscriptionToken);
@@ -998,11 +1325,11 @@ export class ERC20ProxyContract extends BaseContract {
}
/**
* Gets historical logs without creating a subscription
* @param eventName The ERC20Proxy contract event you would like to subscribe to.
* @param blockRange Block range to get logs from.
* @param indexFilterValues An object where the keys are indexed args returned by the event and
* the value is the value you are interested in. E.g `{_from: aUserAddressHex}`
* @return Array of logs that match the parameters
* @param eventName The ERC20Proxy contract event you would like to subscribe to.
* @param blockRange Block range to get logs from.
* @param indexFilterValues An object where the keys are indexed args returned by the event and
* the value is the value you are interested in. E.g `{_from: aUserAddressHex}`
* @return Array of logs that match the parameters
*/
public async getLogsAsync<ArgsType extends ERC20ProxyEventArgs>(
eventName: ERC20ProxyEvents,

View File

@@ -54,7 +54,18 @@ export interface ERC20TokenApprovalEventArgs extends DecodedLogArgs {
// tslint:disable:no-parameter-reassignment
// tslint:disable-next-line:class-name
export class ERC20TokenContract extends BaseContract {
/**
* `msg.sender` approves `_spender` to spend `_value` tokens
*/
public approve = {
/**
* Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write
* Ethereum operation and will cost gas.
* @param _spender The address of the account able to transfer the tokens
* @param _value The amount of wei to be approved for transfer
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async sendTransactionAsync(
_spender: string,
_value: BigNumber,
@@ -83,6 +94,15 @@ export class ERC20TokenContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
/**
* Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting.
* If the transaction was mined, but reverted, an error is thrown.
* @param _spender The address of the account able to transfer the tokens
* @param _value The amount of wei to be approved for transfer
* @param txData Additional data for transaction
* @param pollingIntervalMs Interval at which to poll for success
* @returns A promise that resolves when the transaction is successful
*/
awaitTransactionSuccessAsync(
_spender: string,
_value: BigNumber,
@@ -106,6 +126,13 @@ export class ERC20TokenContract extends BaseContract {
})(),
);
},
/**
* Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments.
* @param _spender The address of the account able to transfer the tokens
* @param _value The amount of wei to be approved for transfer
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async estimateGasAsync(
_spender: string,
_value: BigNumber,
@@ -133,6 +160,14 @@ export class ERC20TokenContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @param _spender The address of the account able to transfer the tokens
* @param _value The amount of wei to be approved for transfer
* @returns Always true if the call has enough gas to complete execution
*/
async callAsync(
_spender: string,
_value: BigNumber,
@@ -174,6 +209,13 @@ export class ERC20TokenContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
* @param _spender The address of the account able to transfer the tokens
* @param _value The amount of wei to be approved for transfer
*/
getABIEncodedTransactionData(_spender: string, _value: BigNumber): string {
assert.isString('_spender', _spender);
assert.isBigNumber('_value', _value);
@@ -184,8 +226,31 @@ export class ERC20TokenContract extends BaseContract {
]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): boolean {
const self = (this as any) as ERC20TokenContract;
const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<boolean>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): boolean {
const self = (this as any) as ERC20TokenContract;
const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<boolean>(returnData);
return abiDecodedReturnData;
},
};
/**
* Query total supply of token
*/
public totalSupply = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @returns Total supply of token
*/
async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<BigNumber> {
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
schemas.addressSchema,
@@ -217,13 +282,44 @@ export class ERC20TokenContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(): string {
const self = (this as any) as ERC20TokenContract;
const abiEncodedTransactionData = self._strictEncodeArguments('totalSupply()', []);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): BigNumber {
const self = (this as any) as ERC20TokenContract;
const abiEncoder = self._lookupAbiEncoder('totalSupply()');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<BigNumber>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): BigNumber {
const self = (this as any) as ERC20TokenContract;
const abiEncoder = self._lookupAbiEncoder('totalSupply()');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<BigNumber>(returnData);
return abiDecodedReturnData;
},
};
/**
* send `value` token to `to` from `from` on the condition it is approved by `from`
*/
public transferFrom = {
/**
* Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write
* Ethereum operation and will cost gas.
* @param _from The address of the sender
* @param _to The address of the recipient
* @param _value The amount of token to be transferred
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async sendTransactionAsync(
_from: string,
_to: string,
@@ -255,6 +351,16 @@ export class ERC20TokenContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
/**
* Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting.
* If the transaction was mined, but reverted, an error is thrown.
* @param _from The address of the sender
* @param _to The address of the recipient
* @param _value The amount of token to be transferred
* @param txData Additional data for transaction
* @param pollingIntervalMs Interval at which to poll for success
* @returns A promise that resolves when the transaction is successful
*/
awaitTransactionSuccessAsync(
_from: string,
_to: string,
@@ -285,6 +391,14 @@ export class ERC20TokenContract extends BaseContract {
})(),
);
},
/**
* Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments.
* @param _from The address of the sender
* @param _to The address of the recipient
* @param _value The amount of token to be transferred
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async estimateGasAsync(
_from: string,
_to: string,
@@ -315,6 +429,15 @@ export class ERC20TokenContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @param _from The address of the sender
* @param _to The address of the recipient
* @param _value The amount of token to be transferred
* @returns True if transfer was successful
*/
async callAsync(
_from: string,
_to: string,
@@ -359,6 +482,14 @@ export class ERC20TokenContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
* @param _from The address of the sender
* @param _to The address of the recipient
* @param _value The amount of token to be transferred
*/
getABIEncodedTransactionData(_from: string, _to: string, _value: BigNumber): string {
assert.isString('_from', _from);
assert.isString('_to', _to);
@@ -371,8 +502,32 @@ export class ERC20TokenContract extends BaseContract {
]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): boolean {
const self = (this as any) as ERC20TokenContract;
const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<boolean>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): boolean {
const self = (this as any) as ERC20TokenContract;
const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<boolean>(returnData);
return abiDecodedReturnData;
},
};
/**
* Query the balance of owner
*/
public balanceOf = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @param _owner The address from which the balance will be retrieved
* @returns Balance of owner
*/
async callAsync(
_owner: string,
callData: Partial<CallData> = {},
@@ -409,14 +564,45 @@ export class ERC20TokenContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
* @param _owner The address from which the balance will be retrieved
*/
getABIEncodedTransactionData(_owner: string): string {
assert.isString('_owner', _owner);
const self = (this as any) as ERC20TokenContract;
const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): BigNumber {
const self = (this as any) as ERC20TokenContract;
const abiEncoder = self._lookupAbiEncoder('balanceOf(address)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<BigNumber>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): BigNumber {
const self = (this as any) as ERC20TokenContract;
const abiEncoder = self._lookupAbiEncoder('balanceOf(address)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<BigNumber>(returnData);
return abiDecodedReturnData;
},
};
/**
* send `value` token to `to` from `msg.sender`
*/
public transfer = {
/**
* Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write
* Ethereum operation and will cost gas.
* @param _to The address of the recipient
* @param _value The amount of token to be transferred
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async sendTransactionAsync(
_to: string,
_value: BigNumber,
@@ -442,6 +628,15 @@ export class ERC20TokenContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
/**
* Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting.
* If the transaction was mined, but reverted, an error is thrown.
* @param _to The address of the recipient
* @param _value The amount of token to be transferred
* @param txData Additional data for transaction
* @param pollingIntervalMs Interval at which to poll for success
* @returns A promise that resolves when the transaction is successful
*/
awaitTransactionSuccessAsync(
_to: string,
_value: BigNumber,
@@ -465,6 +660,13 @@ export class ERC20TokenContract extends BaseContract {
})(),
);
},
/**
* Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments.
* @param _to The address of the recipient
* @param _value The amount of token to be transferred
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async estimateGasAsync(_to: string, _value: BigNumber, txData?: Partial<TxData> | undefined): Promise<number> {
assert.isString('_to', _to);
assert.isBigNumber('_value', _value);
@@ -485,6 +687,14 @@ export class ERC20TokenContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @param _to The address of the recipient
* @param _value The amount of token to be transferred
* @returns True if transfer was successful
*/
async callAsync(
_to: string,
_value: BigNumber,
@@ -523,6 +733,13 @@ export class ERC20TokenContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
* @param _to The address of the recipient
* @param _value The amount of token to be transferred
*/
getABIEncodedTransactionData(_to: string, _value: BigNumber): string {
assert.isString('_to', _to);
assert.isBigNumber('_value', _value);
@@ -533,8 +750,30 @@ export class ERC20TokenContract extends BaseContract {
]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): boolean {
const self = (this as any) as ERC20TokenContract;
const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<boolean>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): boolean {
const self = (this as any) as ERC20TokenContract;
const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<boolean>(returnData);
return abiDecodedReturnData;
},
};
public allowance = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @param _owner The address of the account owning tokens
* @param _spender The address of the account able to transfer the tokens
* @returns Amount of remaining tokens allowed to spent
*/
async callAsync(
_owner: string,
_spender: string,
@@ -576,6 +815,13 @@ export class ERC20TokenContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
* @param _owner The address of the account owning tokens
* @param _spender The address of the account able to transfer the tokens
*/
getABIEncodedTransactionData(_owner: string, _spender: string): string {
assert.isString('_owner', _owner);
assert.isString('_spender', _spender);
@@ -586,6 +832,20 @@ export class ERC20TokenContract extends BaseContract {
]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): BigNumber {
const self = (this as any) as ERC20TokenContract;
const abiEncoder = self._lookupAbiEncoder('allowance(address,address)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<BigNumber>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): BigNumber {
const self = (this as any) as ERC20TokenContract;
const abiEncoder = self._lookupAbiEncoder('allowance(address,address)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<BigNumber>(returnData);
return abiDecodedReturnData;
},
};
private readonly _subscriptionManager: SubscriptionManager<ERC20TokenEventArgs, ERC20TokenEvents>;
public static async deployFrom0xArtifactAsync(
@@ -606,8 +866,10 @@ export class ERC20TokenContract extends BaseContract {
const bytecode = artifact.compilerOutput.evm.bytecode.object;
const abi = artifact.compilerOutput.abi;
const logDecodeDependenciesAbiOnly: { [contractName: string]: ContractAbi } = {};
for (const key of Object.keys(logDecodeDependencies)) {
logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi;
if (Object.keys(logDecodeDependencies) !== undefined) {
for (const key of Object.keys(logDecodeDependencies)) {
logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi;
}
}
return ERC20TokenContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly);
}
@@ -835,11 +1097,11 @@ export class ERC20TokenContract extends BaseContract {
}
/**
* Subscribe to an event type emitted by the ERC20Token contract.
* @param eventName The ERC20Token contract event you would like to subscribe to.
* @param indexFilterValues An object where the keys are indexed args returned by the event and
* the value is the value you are interested in. E.g `{maker: aUserAddressHex}`
* @param callback Callback that gets called when a log is added/removed
* @param isVerbose Enable verbose subscription warnings (e.g recoverable network issues encountered)
* @param eventName The ERC20Token contract event you would like to subscribe to.
* @param indexFilterValues An object where the keys are indexed args returned by the event and
* the value is the value you are interested in. E.g `{maker: aUserAddressHex}`
* @param callback Callback that gets called when a log is added/removed
* @param isVerbose Enable verbose subscription warnings (e.g recoverable network issues encountered)
* @return Subscription token used later to unsubscribe
*/
public subscribe<ArgsType extends ERC20TokenEventArgs>(
@@ -865,7 +1127,7 @@ export class ERC20TokenContract extends BaseContract {
}
/**
* Cancel a subscription
* @param subscriptionToken Subscription token returned by `subscribe()`
* @param subscriptionToken Subscription token returned by `subscribe()`
*/
public unsubscribe(subscriptionToken: string): void {
this._subscriptionManager.unsubscribe(subscriptionToken);
@@ -878,11 +1140,11 @@ export class ERC20TokenContract extends BaseContract {
}
/**
* Gets historical logs without creating a subscription
* @param eventName The ERC20Token contract event you would like to subscribe to.
* @param blockRange Block range to get logs from.
* @param indexFilterValues An object where the keys are indexed args returned by the event and
* the value is the value you are interested in. E.g `{_from: aUserAddressHex}`
* @return Array of logs that match the parameters
* @param eventName The ERC20Token contract event you would like to subscribe to.
* @param blockRange Block range to get logs from.
* @param indexFilterValues An object where the keys are indexed args returned by the event and
* the value is the value you are interested in. E.g `{_from: aUserAddressHex}`
* @return Array of logs that match the parameters
*/
public async getLogsAsync<ArgsType extends ERC20TokenEventArgs>(
eventName: ERC20TokenEvents,

View File

@@ -54,7 +54,17 @@ export interface ERC721ProxyAuthorizedAddressRemovedEventArgs extends DecodedLog
// tslint:disable:no-parameter-reassignment
// tslint:disable-next-line:class-name
export class ERC721ProxyContract extends BaseContract {
/**
* Authorizes an address.
*/
public addAuthorizedAddress = {
/**
* Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write
* Ethereum operation and will cost gas.
* @param target Address to authorize.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async sendTransactionAsync(target: string, txData?: Partial<TxData> | undefined): Promise<string> {
assert.isString('target', target);
const self = (this as any) as ERC721ProxyContract;
@@ -75,6 +85,14 @@ export class ERC721ProxyContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
/**
* Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting.
* If the transaction was mined, but reverted, an error is thrown.
* @param target Address to authorize.
* @param txData Additional data for transaction
* @param pollingIntervalMs Interval at which to poll for success
* @returns A promise that resolves when the transaction is successful
*/
awaitTransactionSuccessAsync(
target: string,
txData?: Partial<TxData>,
@@ -96,6 +114,12 @@ export class ERC721ProxyContract extends BaseContract {
})(),
);
},
/**
* Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments.
* @param target Address to authorize.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async estimateGasAsync(target: string, txData?: Partial<TxData> | undefined): Promise<number> {
assert.isString('target', target);
const self = (this as any) as ERC721ProxyContract;
@@ -115,6 +139,12 @@ export class ERC721ProxyContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @param target Address to authorize.
*/
async callAsync(target: string, callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<void> {
assert.isString('target', target);
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
@@ -147,6 +177,12 @@ export class ERC721ProxyContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
* @param target Address to authorize.
*/
getABIEncodedTransactionData(target: string): string {
assert.isString('target', target);
const self = (this as any) as ERC721ProxyContract;
@@ -155,8 +191,27 @@ export class ERC721ProxyContract extends BaseContract {
]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): void {
const self = (this as any) as ERC721ProxyContract;
const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<void>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): void {
const self = (this as any) as ERC721ProxyContract;
const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
};
public authorities = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
*/
async callAsync(
index_0: BigNumber,
callData: Partial<CallData> = {},
@@ -193,14 +248,43 @@ export class ERC721ProxyContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(index_0: BigNumber): string {
assert.isBigNumber('index_0', index_0);
const self = (this as any) as ERC721ProxyContract;
const abiEncodedTransactionData = self._strictEncodeArguments('authorities(uint256)', [index_0]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): string {
const self = (this as any) as ERC721ProxyContract;
const abiEncoder = self._lookupAbiEncoder('authorities(uint256)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<string>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): string {
const self = (this as any) as ERC721ProxyContract;
const abiEncoder = self._lookupAbiEncoder('authorities(uint256)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<string>(returnData);
return abiDecodedReturnData;
},
};
/**
* Removes authorizion of an address.
*/
public removeAuthorizedAddress = {
/**
* Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write
* Ethereum operation and will cost gas.
* @param target Address to remove authorization from.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async sendTransactionAsync(target: string, txData?: Partial<TxData> | undefined): Promise<string> {
assert.isString('target', target);
const self = (this as any) as ERC721ProxyContract;
@@ -221,6 +305,14 @@ export class ERC721ProxyContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
/**
* Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting.
* If the transaction was mined, but reverted, an error is thrown.
* @param target Address to remove authorization from.
* @param txData Additional data for transaction
* @param pollingIntervalMs Interval at which to poll for success
* @returns A promise that resolves when the transaction is successful
*/
awaitTransactionSuccessAsync(
target: string,
txData?: Partial<TxData>,
@@ -242,6 +334,12 @@ export class ERC721ProxyContract extends BaseContract {
})(),
);
},
/**
* Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments.
* @param target Address to remove authorization from.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async estimateGasAsync(target: string, txData?: Partial<TxData> | undefined): Promise<number> {
assert.isString('target', target);
const self = (this as any) as ERC721ProxyContract;
@@ -261,6 +359,12 @@ export class ERC721ProxyContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @param target Address to remove authorization from.
*/
async callAsync(target: string, callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<void> {
assert.isString('target', target);
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
@@ -293,6 +397,12 @@ export class ERC721ProxyContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
* @param target Address to remove authorization from.
*/
getABIEncodedTransactionData(target: string): string {
assert.isString('target', target);
const self = (this as any) as ERC721ProxyContract;
@@ -301,8 +411,27 @@ export class ERC721ProxyContract extends BaseContract {
]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): void {
const self = (this as any) as ERC721ProxyContract;
const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<void>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): void {
const self = (this as any) as ERC721ProxyContract;
const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
};
public owner = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
*/
async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<string> {
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
schemas.addressSchema,
@@ -334,13 +463,43 @@ export class ERC721ProxyContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(): string {
const self = (this as any) as ERC721ProxyContract;
const abiEncodedTransactionData = self._strictEncodeArguments('owner()', []);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): string {
const self = (this as any) as ERC721ProxyContract;
const abiEncoder = self._lookupAbiEncoder('owner()');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<string>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): string {
const self = (this as any) as ERC721ProxyContract;
const abiEncoder = self._lookupAbiEncoder('owner()');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<string>(returnData);
return abiDecodedReturnData;
},
};
/**
* Removes authorizion of an address.
*/
public removeAuthorizedAddressAtIndex = {
/**
* Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write
* Ethereum operation and will cost gas.
* @param target Address to remove authorization from.
* @param index Index of target in authorities array.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async sendTransactionAsync(
target: string,
index: BigNumber,
@@ -369,6 +528,15 @@ export class ERC721ProxyContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
/**
* Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting.
* If the transaction was mined, but reverted, an error is thrown.
* @param target Address to remove authorization from.
* @param index Index of target in authorities array.
* @param txData Additional data for transaction
* @param pollingIntervalMs Interval at which to poll for success
* @returns A promise that resolves when the transaction is successful
*/
awaitTransactionSuccessAsync(
target: string,
index: BigNumber,
@@ -396,6 +564,13 @@ export class ERC721ProxyContract extends BaseContract {
})(),
);
},
/**
* Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments.
* @param target Address to remove authorization from.
* @param index Index of target in authorities array.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async estimateGasAsync(
target: string,
index: BigNumber,
@@ -423,6 +598,13 @@ export class ERC721ProxyContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @param target Address to remove authorization from.
* @param index Index of target in authorities array.
*/
async callAsync(
target: string,
index: BigNumber,
@@ -464,6 +646,13 @@ export class ERC721ProxyContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
* @param target Address to remove authorization from.
* @param index Index of target in authorities array.
*/
getABIEncodedTransactionData(target: string, index: BigNumber): string {
assert.isString('target', target);
assert.isBigNumber('index', index);
@@ -474,8 +663,31 @@ export class ERC721ProxyContract extends BaseContract {
);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): void {
const self = (this as any) as ERC721ProxyContract;
const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<void>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): void {
const self = (this as any) as ERC721ProxyContract;
const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
};
/**
* Gets the proxy id associated with the proxy address.
*/
public getProxyId = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @returns Proxy id.
*/
async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<string> {
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
schemas.addressSchema,
@@ -507,13 +719,37 @@ export class ERC721ProxyContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(): string {
const self = (this as any) as ERC721ProxyContract;
const abiEncodedTransactionData = self._strictEncodeArguments('getProxyId()', []);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): string {
const self = (this as any) as ERC721ProxyContract;
const abiEncoder = self._lookupAbiEncoder('getProxyId()');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<string>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): string {
const self = (this as any) as ERC721ProxyContract;
const abiEncoder = self._lookupAbiEncoder('getProxyId()');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<string>(returnData);
return abiDecodedReturnData;
},
};
public authorized = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
*/
async callAsync(
index_0: string,
callData: Partial<CallData> = {},
@@ -550,6 +786,11 @@ export class ERC721ProxyContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(index_0: string): string {
assert.isString('index_0', index_0);
const self = (this as any) as ERC721ProxyContract;
@@ -558,8 +799,31 @@ export class ERC721ProxyContract extends BaseContract {
]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): boolean {
const self = (this as any) as ERC721ProxyContract;
const abiEncoder = self._lookupAbiEncoder('authorized(address)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<boolean>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): boolean {
const self = (this as any) as ERC721ProxyContract;
const abiEncoder = self._lookupAbiEncoder('authorized(address)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<boolean>(returnData);
return abiDecodedReturnData;
},
};
/**
* Gets all authorized addresses.
*/
public getAuthorizedAddresses = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @returns Array of authorized addresses.
*/
async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<string[]> {
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
schemas.addressSchema,
@@ -591,13 +855,38 @@ export class ERC721ProxyContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(): string {
const self = (this as any) as ERC721ProxyContract;
const abiEncodedTransactionData = self._strictEncodeArguments('getAuthorizedAddresses()', []);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): string[] {
const self = (this as any) as ERC721ProxyContract;
const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<string[]>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): string[] {
const self = (this as any) as ERC721ProxyContract;
const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<string[]>(returnData);
return abiDecodedReturnData;
},
};
public transferOwnership = {
/**
* Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write
* Ethereum operation and will cost gas.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async sendTransactionAsync(newOwner: string, txData?: Partial<TxData> | undefined): Promise<string> {
assert.isString('newOwner', newOwner);
const self = (this as any) as ERC721ProxyContract;
@@ -618,6 +907,13 @@ export class ERC721ProxyContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
/**
* Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting.
* If the transaction was mined, but reverted, an error is thrown.
* @param txData Additional data for transaction
* @param pollingIntervalMs Interval at which to poll for success
* @returns A promise that resolves when the transaction is successful
*/
awaitTransactionSuccessAsync(
newOwner: string,
txData?: Partial<TxData>,
@@ -639,6 +935,11 @@ export class ERC721ProxyContract extends BaseContract {
})(),
);
},
/**
* Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async estimateGasAsync(newOwner: string, txData?: Partial<TxData> | undefined): Promise<number> {
assert.isString('newOwner', newOwner);
const self = (this as any) as ERC721ProxyContract;
@@ -658,6 +959,11 @@ export class ERC721ProxyContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
*/
async callAsync(newOwner: string, callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<void> {
assert.isString('newOwner', newOwner);
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
@@ -690,6 +996,11 @@ export class ERC721ProxyContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(newOwner: string): string {
assert.isString('newOwner', newOwner);
const self = (this as any) as ERC721ProxyContract;
@@ -698,6 +1009,20 @@ export class ERC721ProxyContract extends BaseContract {
]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): void {
const self = (this as any) as ERC721ProxyContract;
const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<void>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): void {
const self = (this as any) as ERC721ProxyContract;
const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
};
private readonly _subscriptionManager: SubscriptionManager<ERC721ProxyEventArgs, ERC721ProxyEvents>;
public static async deployFrom0xArtifactAsync(
@@ -718,8 +1043,10 @@ export class ERC721ProxyContract extends BaseContract {
const bytecode = artifact.compilerOutput.evm.bytecode.object;
const abi = artifact.compilerOutput.abi;
const logDecodeDependenciesAbiOnly: { [contractName: string]: ContractAbi } = {};
for (const key of Object.keys(logDecodeDependencies)) {
logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi;
if (Object.keys(logDecodeDependencies) !== undefined) {
for (const key of Object.keys(logDecodeDependencies)) {
logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi;
}
}
return ERC721ProxyContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly);
}
@@ -955,11 +1282,11 @@ export class ERC721ProxyContract extends BaseContract {
}
/**
* Subscribe to an event type emitted by the ERC721Proxy contract.
* @param eventName The ERC721Proxy contract event you would like to subscribe to.
* @param indexFilterValues An object where the keys are indexed args returned by the event and
* the value is the value you are interested in. E.g `{maker: aUserAddressHex}`
* @param callback Callback that gets called when a log is added/removed
* @param isVerbose Enable verbose subscription warnings (e.g recoverable network issues encountered)
* @param eventName The ERC721Proxy contract event you would like to subscribe to.
* @param indexFilterValues An object where the keys are indexed args returned by the event and
* the value is the value you are interested in. E.g `{maker: aUserAddressHex}`
* @param callback Callback that gets called when a log is added/removed
* @param isVerbose Enable verbose subscription warnings (e.g recoverable network issues encountered)
* @return Subscription token used later to unsubscribe
*/
public subscribe<ArgsType extends ERC721ProxyEventArgs>(
@@ -985,7 +1312,7 @@ export class ERC721ProxyContract extends BaseContract {
}
/**
* Cancel a subscription
* @param subscriptionToken Subscription token returned by `subscribe()`
* @param subscriptionToken Subscription token returned by `subscribe()`
*/
public unsubscribe(subscriptionToken: string): void {
this._subscriptionManager.unsubscribe(subscriptionToken);
@@ -998,11 +1325,11 @@ export class ERC721ProxyContract extends BaseContract {
}
/**
* Gets historical logs without creating a subscription
* @param eventName The ERC721Proxy contract event you would like to subscribe to.
* @param blockRange Block range to get logs from.
* @param indexFilterValues An object where the keys are indexed args returned by the event and
* the value is the value you are interested in. E.g `{_from: aUserAddressHex}`
* @return Array of logs that match the parameters
* @param eventName The ERC721Proxy contract event you would like to subscribe to.
* @param blockRange Block range to get logs from.
* @param indexFilterValues An object where the keys are indexed args returned by the event and
* the value is the value you are interested in. E.g `{_from: aUserAddressHex}`
* @return Array of logs that match the parameters
*/
public async getLogsAsync<ArgsType extends ERC721ProxyEventArgs>(
eventName: ERC721ProxyEvents,

View File

@@ -64,7 +64,17 @@ export interface ERC721TokenApprovalForAllEventArgs extends DecodedLogArgs {
// tslint:disable:no-parameter-reassignment
// tslint:disable-next-line:class-name
export class ERC721TokenContract extends BaseContract {
/**
* Throws if `_tokenId` is not a valid NFT.
*/
public getApproved = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @param _tokenId The NFT to find the approved address for
* @returns The approved address for this NFT, or the zero address if there is none
*/
async callAsync(
_tokenId: BigNumber,
callData: Partial<CallData> = {},
@@ -101,14 +111,47 @@ export class ERC721TokenContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
* @param _tokenId The NFT to find the approved address for
*/
getABIEncodedTransactionData(_tokenId: BigNumber): string {
assert.isBigNumber('_tokenId', _tokenId);
const self = (this as any) as ERC721TokenContract;
const abiEncodedTransactionData = self._strictEncodeArguments('getApproved(uint256)', [_tokenId]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): string {
const self = (this as any) as ERC721TokenContract;
const abiEncoder = self._lookupAbiEncoder('getApproved(uint256)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<string>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): string {
const self = (this as any) as ERC721TokenContract;
const abiEncoder = self._lookupAbiEncoder('getApproved(uint256)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<string>(returnData);
return abiDecodedReturnData;
},
};
/**
* The zero address indicates there is no approved address.
* Throws unless `msg.sender` is the current NFT owner, or an authorized
* operator of the current owner.
*/
public approve = {
/**
* Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write
* Ethereum operation and will cost gas.
* @param _approved The new approved NFT controller
* @param _tokenId The NFT to approve
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async sendTransactionAsync(
_approved: string,
_tokenId: BigNumber,
@@ -137,6 +180,15 @@ export class ERC721TokenContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
/**
* Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting.
* If the transaction was mined, but reverted, an error is thrown.
* @param _approved The new approved NFT controller
* @param _tokenId The NFT to approve
* @param txData Additional data for transaction
* @param pollingIntervalMs Interval at which to poll for success
* @returns A promise that resolves when the transaction is successful
*/
awaitTransactionSuccessAsync(
_approved: string,
_tokenId: BigNumber,
@@ -160,6 +212,13 @@ export class ERC721TokenContract extends BaseContract {
})(),
);
},
/**
* Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments.
* @param _approved The new approved NFT controller
* @param _tokenId The NFT to approve
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async estimateGasAsync(
_approved: string,
_tokenId: BigNumber,
@@ -187,6 +246,13 @@ export class ERC721TokenContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @param _approved The new approved NFT controller
* @param _tokenId The NFT to approve
*/
async callAsync(
_approved: string,
_tokenId: BigNumber,
@@ -228,6 +294,13 @@ export class ERC721TokenContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
* @param _approved The new approved NFT controller
* @param _tokenId The NFT to approve
*/
getABIEncodedTransactionData(_approved: string, _tokenId: BigNumber): string {
assert.isString('_approved', _approved);
assert.isBigNumber('_tokenId', _tokenId);
@@ -238,8 +311,37 @@ export class ERC721TokenContract extends BaseContract {
]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): void {
const self = (this as any) as ERC721TokenContract;
const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<void>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): void {
const self = (this as any) as ERC721TokenContract;
const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
};
/**
* Throws unless `msg.sender` is the current owner, an authorized
* operator, or the approved address for this NFT. Throws if `_from` is
* not the current owner. Throws if `_to` is the zero address. Throws if
* `_tokenId` is not a valid NFT.
*/
public transferFrom = {
/**
* Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write
* Ethereum operation and will cost gas.
* @param _from The current owner of the NFT
* @param _to The new owner
* @param _tokenId The NFT to transfer
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async sendTransactionAsync(
_from: string,
_to: string,
@@ -271,6 +373,16 @@ export class ERC721TokenContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
/**
* Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting.
* If the transaction was mined, but reverted, an error is thrown.
* @param _from The current owner of the NFT
* @param _to The new owner
* @param _tokenId The NFT to transfer
* @param txData Additional data for transaction
* @param pollingIntervalMs Interval at which to poll for success
* @returns A promise that resolves when the transaction is successful
*/
awaitTransactionSuccessAsync(
_from: string,
_to: string,
@@ -301,6 +413,14 @@ export class ERC721TokenContract extends BaseContract {
})(),
);
},
/**
* Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments.
* @param _from The current owner of the NFT
* @param _to The new owner
* @param _tokenId The NFT to transfer
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async estimateGasAsync(
_from: string,
_to: string,
@@ -331,6 +451,14 @@ export class ERC721TokenContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @param _from The current owner of the NFT
* @param _to The new owner
* @param _tokenId The NFT to transfer
*/
async callAsync(
_from: string,
_to: string,
@@ -375,6 +503,14 @@ export class ERC721TokenContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
* @param _from The current owner of the NFT
* @param _to The new owner
* @param _tokenId The NFT to transfer
*/
getABIEncodedTransactionData(_from: string, _to: string, _tokenId: BigNumber): string {
assert.isString('_from', _from);
assert.isString('_to', _to);
@@ -387,8 +523,35 @@ export class ERC721TokenContract extends BaseContract {
]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): void {
const self = (this as any) as ERC721TokenContract;
const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<void>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): void {
const self = (this as any) as ERC721TokenContract;
const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
};
/**
* This works identically to the other function with an extra data parameter,
* except this function just sets data to "".
*/
public safeTransferFrom1 = {
/**
* Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write
* Ethereum operation and will cost gas.
* @param _from The current owner of the NFT
* @param _to The new owner
* @param _tokenId The NFT to transfer
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async sendTransactionAsync(
_from: string,
_to: string,
@@ -420,6 +583,16 @@ export class ERC721TokenContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
/**
* Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting.
* If the transaction was mined, but reverted, an error is thrown.
* @param _from The current owner of the NFT
* @param _to The new owner
* @param _tokenId The NFT to transfer
* @param txData Additional data for transaction
* @param pollingIntervalMs Interval at which to poll for success
* @returns A promise that resolves when the transaction is successful
*/
awaitTransactionSuccessAsync(
_from: string,
_to: string,
@@ -450,6 +623,14 @@ export class ERC721TokenContract extends BaseContract {
})(),
);
},
/**
* Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments.
* @param _from The current owner of the NFT
* @param _to The new owner
* @param _tokenId The NFT to transfer
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async estimateGasAsync(
_from: string,
_to: string,
@@ -480,6 +661,14 @@ export class ERC721TokenContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @param _from The current owner of the NFT
* @param _to The new owner
* @param _tokenId The NFT to transfer
*/
async callAsync(
_from: string,
_to: string,
@@ -524,6 +713,14 @@ export class ERC721TokenContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
* @param _from The current owner of the NFT
* @param _to The new owner
* @param _tokenId The NFT to transfer
*/
getABIEncodedTransactionData(_from: string, _to: string, _tokenId: BigNumber): string {
assert.isString('_from', _from);
assert.isString('_to', _to);
@@ -536,8 +733,33 @@ export class ERC721TokenContract extends BaseContract {
]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): void {
const self = (this as any) as ERC721TokenContract;
const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<void>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): void {
const self = (this as any) as ERC721TokenContract;
const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
};
/**
* NFTs assigned to zero address are considered invalid, and queries
* about them do throw.
*/
public ownerOf = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @param _tokenId The identifier for an NFT
* @returns The address of the owner of the NFT
*/
async callAsync(
_tokenId: BigNumber,
callData: Partial<CallData> = {},
@@ -574,14 +796,45 @@ export class ERC721TokenContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
* @param _tokenId The identifier for an NFT
*/
getABIEncodedTransactionData(_tokenId: BigNumber): string {
assert.isBigNumber('_tokenId', _tokenId);
const self = (this as any) as ERC721TokenContract;
const abiEncodedTransactionData = self._strictEncodeArguments('ownerOf(uint256)', [_tokenId]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): string {
const self = (this as any) as ERC721TokenContract;
const abiEncoder = self._lookupAbiEncoder('ownerOf(uint256)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<string>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): string {
const self = (this as any) as ERC721TokenContract;
const abiEncoder = self._lookupAbiEncoder('ownerOf(uint256)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<string>(returnData);
return abiDecodedReturnData;
},
};
/**
* NFTs assigned to the zero address are considered invalid, and this
* function throws for queries about the zero address.
*/
public balanceOf = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @param _owner An address for whom to query the balance
* @returns The number of NFTs owned by &#x60;_owner&#x60;, possibly zero
*/
async callAsync(
_owner: string,
callData: Partial<CallData> = {},
@@ -618,14 +871,46 @@ export class ERC721TokenContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
* @param _owner An address for whom to query the balance
*/
getABIEncodedTransactionData(_owner: string): string {
assert.isString('_owner', _owner);
const self = (this as any) as ERC721TokenContract;
const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): BigNumber {
const self = (this as any) as ERC721TokenContract;
const abiEncoder = self._lookupAbiEncoder('balanceOf(address)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<BigNumber>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): BigNumber {
const self = (this as any) as ERC721TokenContract;
const abiEncoder = self._lookupAbiEncoder('balanceOf(address)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<BigNumber>(returnData);
return abiDecodedReturnData;
},
};
/**
* Emits the ApprovalForAll event. The contract MUST allow
* multiple operators per owner.
*/
public setApprovalForAll = {
/**
* Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write
* Ethereum operation and will cost gas.
* @param _operator Address to add to the set of authorized operators
* @param _approved True if the operator is approved, false to revoke approval
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async sendTransactionAsync(
_operator: string,
_approved: boolean,
@@ -654,6 +939,15 @@ export class ERC721TokenContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
/**
* Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting.
* If the transaction was mined, but reverted, an error is thrown.
* @param _operator Address to add to the set of authorized operators
* @param _approved True if the operator is approved, false to revoke approval
* @param txData Additional data for transaction
* @param pollingIntervalMs Interval at which to poll for success
* @returns A promise that resolves when the transaction is successful
*/
awaitTransactionSuccessAsync(
_operator: string,
_approved: boolean,
@@ -681,6 +975,13 @@ export class ERC721TokenContract extends BaseContract {
})(),
);
},
/**
* Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments.
* @param _operator Address to add to the set of authorized operators
* @param _approved True if the operator is approved, false to revoke approval
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async estimateGasAsync(
_operator: string,
_approved: boolean,
@@ -708,6 +1009,13 @@ export class ERC721TokenContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @param _operator Address to add to the set of authorized operators
* @param _approved True if the operator is approved, false to revoke approval
*/
async callAsync(
_operator: string,
_approved: boolean,
@@ -749,6 +1057,13 @@ export class ERC721TokenContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
* @param _operator Address to add to the set of authorized operators
* @param _approved True if the operator is approved, false to revoke approval
*/
getABIEncodedTransactionData(_operator: string, _approved: boolean): string {
assert.isString('_operator', _operator);
assert.isBoolean('_approved', _approved);
@@ -759,8 +1074,41 @@ export class ERC721TokenContract extends BaseContract {
]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): void {
const self = (this as any) as ERC721TokenContract;
const abiEncoder = self._lookupAbiEncoder('setApprovalForAll(address,bool)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<void>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): void {
const self = (this as any) as ERC721TokenContract;
const abiEncoder = self._lookupAbiEncoder('setApprovalForAll(address,bool)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
};
/**
* Throws unless `msg.sender` is the current owner, an authorized
* operator, or the approved address for this NFT. Throws if `_from` is
* not the current owner. Throws if `_to` is the zero address. Throws if
* `_tokenId` is not a valid NFT. When transfer is complete, this function
* checks if `_to` is a smart contract (code size > 0). If so, it calls
* `onERC721Received` on `_to` and throws if the return value is not
* `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`.
*/
public safeTransferFrom2 = {
/**
* Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write
* Ethereum operation and will cost gas.
* @param _from The current owner of the NFT
* @param _to The new owner
* @param _tokenId The NFT to transfer
* @param _data Additional data with no specified format, sent in call to `_to`
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async sendTransactionAsync(
_from: string,
_to: string,
@@ -801,6 +1149,17 @@ export class ERC721TokenContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
/**
* Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting.
* If the transaction was mined, but reverted, an error is thrown.
* @param _from The current owner of the NFT
* @param _to The new owner
* @param _tokenId The NFT to transfer
* @param _data Additional data with no specified format, sent in call to `_to`
* @param txData Additional data for transaction
* @param pollingIntervalMs Interval at which to poll for success
* @returns A promise that resolves when the transaction is successful
*/
awaitTransactionSuccessAsync(
_from: string,
_to: string,
@@ -834,6 +1193,15 @@ export class ERC721TokenContract extends BaseContract {
})(),
);
},
/**
* Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments.
* @param _from The current owner of the NFT
* @param _to The new owner
* @param _tokenId The NFT to transfer
* @param _data Additional data with no specified format, sent in call to `_to`
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async estimateGasAsync(
_from: string,
_to: string,
@@ -867,6 +1235,15 @@ export class ERC721TokenContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @param _from The current owner of the NFT
* @param _to The new owner
* @param _tokenId The NFT to transfer
* @param _data Additional data with no specified format, sent in call to `_to`
*/
async callAsync(
_from: string,
_to: string,
@@ -914,6 +1291,15 @@ export class ERC721TokenContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
* @param _from The current owner of the NFT
* @param _to The new owner
* @param _tokenId The NFT to transfer
* @param _data Additional data with no specified format, sent in call to `_to`
*/
getABIEncodedTransactionData(_from: string, _to: string, _tokenId: BigNumber, _data: string): string {
assert.isString('_from', _from);
assert.isString('_to', _to);
@@ -926,8 +1312,30 @@ export class ERC721TokenContract extends BaseContract {
);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): void {
const self = (this as any) as ERC721TokenContract;
const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256,bytes)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<void>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): void {
const self = (this as any) as ERC721TokenContract;
const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256,bytes)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
};
public isApprovedForAll = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @param _owner The address that owns the NFTs
* @param _operator The address that acts on behalf of the owner
* @returns True if &#x60;_operator&#x60; is an approved operator for &#x60;_owner&#x60;, false otherwise
*/
async callAsync(
_owner: string,
_operator: string,
@@ -969,6 +1377,13 @@ export class ERC721TokenContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
* @param _owner The address that owns the NFTs
* @param _operator The address that acts on behalf of the owner
*/
getABIEncodedTransactionData(_owner: string, _operator: string): string {
assert.isString('_owner', _owner);
assert.isString('_operator', _operator);
@@ -979,6 +1394,20 @@ export class ERC721TokenContract extends BaseContract {
]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): boolean {
const self = (this as any) as ERC721TokenContract;
const abiEncoder = self._lookupAbiEncoder('isApprovedForAll(address,address)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<boolean>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): boolean {
const self = (this as any) as ERC721TokenContract;
const abiEncoder = self._lookupAbiEncoder('isApprovedForAll(address,address)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<boolean>(returnData);
return abiDecodedReturnData;
},
};
private readonly _subscriptionManager: SubscriptionManager<ERC721TokenEventArgs, ERC721TokenEvents>;
public static async deployFrom0xArtifactAsync(
@@ -999,8 +1428,10 @@ export class ERC721TokenContract extends BaseContract {
const bytecode = artifact.compilerOutput.evm.bytecode.object;
const abi = artifact.compilerOutput.abi;
const logDecodeDependenciesAbiOnly: { [contractName: string]: ContractAbi } = {};
for (const key of Object.keys(logDecodeDependencies)) {
logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi;
if (Object.keys(logDecodeDependencies) !== undefined) {
for (const key of Object.keys(logDecodeDependencies)) {
logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi;
}
}
return ERC721TokenContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly);
}
@@ -1308,11 +1739,11 @@ export class ERC721TokenContract extends BaseContract {
}
/**
* Subscribe to an event type emitted by the ERC721Token contract.
* @param eventName The ERC721Token contract event you would like to subscribe to.
* @param indexFilterValues An object where the keys are indexed args returned by the event and
* the value is the value you are interested in. E.g `{maker: aUserAddressHex}`
* @param callback Callback that gets called when a log is added/removed
* @param isVerbose Enable verbose subscription warnings (e.g recoverable network issues encountered)
* @param eventName The ERC721Token contract event you would like to subscribe to.
* @param indexFilterValues An object where the keys are indexed args returned by the event and
* the value is the value you are interested in. E.g `{maker: aUserAddressHex}`
* @param callback Callback that gets called when a log is added/removed
* @param isVerbose Enable verbose subscription warnings (e.g recoverable network issues encountered)
* @return Subscription token used later to unsubscribe
*/
public subscribe<ArgsType extends ERC721TokenEventArgs>(
@@ -1338,7 +1769,7 @@ export class ERC721TokenContract extends BaseContract {
}
/**
* Cancel a subscription
* @param subscriptionToken Subscription token returned by `subscribe()`
* @param subscriptionToken Subscription token returned by `subscribe()`
*/
public unsubscribe(subscriptionToken: string): void {
this._subscriptionManager.unsubscribe(subscriptionToken);
@@ -1351,11 +1782,11 @@ export class ERC721TokenContract extends BaseContract {
}
/**
* Gets historical logs without creating a subscription
* @param eventName The ERC721Token contract event you would like to subscribe to.
* @param blockRange Block range to get logs from.
* @param indexFilterValues An object where the keys are indexed args returned by the event and
* the value is the value you are interested in. E.g `{_from: aUserAddressHex}`
* @return Array of logs that match the parameters
* @param eventName The ERC721Token contract event you would like to subscribe to.
* @param blockRange Block range to get logs from.
* @param indexFilterValues An object where the keys are indexed args returned by the event and
* the value is the value you are interested in. E.g `{_from: aUserAddressHex}`
* @return Array of logs that match the parameters
*/
public async getLogsAsync<ArgsType extends ERC721TokenEventArgs>(
eventName: ERC721TokenEvents,

View File

@@ -27,7 +27,17 @@ import * as ethers from 'ethers';
// tslint:disable:no-parameter-reassignment
// tslint:disable-next-line:class-name
export class EthBalanceCheckerContract extends BaseContract {
/**
* Batch fetches ETH balances
*/
public getEthBalances = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @param addresses Array of addresses.
* @returns Array of ETH balances.
*/
async callAsync(
addresses: string[],
callData: Partial<CallData> = {},
@@ -64,12 +74,32 @@ export class EthBalanceCheckerContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
* @param addresses Array of addresses.
*/
getABIEncodedTransactionData(addresses: string[]): string {
assert.isArray('addresses', addresses);
const self = (this as any) as EthBalanceCheckerContract;
const abiEncodedTransactionData = self._strictEncodeArguments('getEthBalances(address[])', [addresses]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): BigNumber[] {
const self = (this as any) as EthBalanceCheckerContract;
const abiEncoder = self._lookupAbiEncoder('getEthBalances(address[])');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<BigNumber[]>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): BigNumber[] {
const self = (this as any) as EthBalanceCheckerContract;
const abiEncoder = self._lookupAbiEncoder('getEthBalances(address[])');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<BigNumber[]>(returnData);
return abiDecodedReturnData;
},
};
public static async deployFrom0xArtifactAsync(
artifact: ContractArtifact | SimpleContractArtifact,
@@ -89,8 +119,10 @@ export class EthBalanceCheckerContract extends BaseContract {
const bytecode = artifact.compilerOutput.evm.bytecode.object;
const abi = artifact.compilerOutput.abi;
const logDecodeDependenciesAbiOnly: { [contractName: string]: ContractAbi } = {};
for (const key of Object.keys(logDecodeDependencies)) {
logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi;
if (Object.keys(logDecodeDependencies) !== undefined) {
for (const key of Object.keys(logDecodeDependencies)) {
logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi;
}
}
return EthBalanceCheckerContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly);
}

File diff suppressed because it is too large Load Diff

View File

@@ -27,7 +27,28 @@ import * as ethers from 'ethers';
// tslint:disable:no-parameter-reassignment
// tslint:disable-next-line:class-name
export class ForwarderContract extends BaseContract {
/**
* Attempt to purchase makerAssetFillAmount of makerAsset by selling ETH provided with transaction.
* Any ZRX required to pay fees for primary orders will automatically be purchased by this contract.
* Any ETH not spent will be refunded to sender.
*/
public marketBuyOrdersWithEth = {
/**
* Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write
* Ethereum operation and will cost gas.
* @param orders Array of order specifications used containing desired
* makerAsset and WETH as takerAsset.
* @param makerAssetFillAmount Desired amount of makerAsset to purchase.
* @param signatures Proofs that orders have been created by makers.
* @param feeOrders Array of order specifications containing ZRX as makerAsset
* and WETH as takerAsset. Used to purchase ZRX for primary order fees.
* @param feeSignatures Proofs that feeOrders have been created by makers.
* @param feePercentage Percentage of WETH sold that will payed as fee to
* forwarding contract feeRecipient.
* @param feeRecipient Address that will receive ETH when orders are filled.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async sendTransactionAsync(
orders: Array<{
makerAddress: string;
@@ -109,6 +130,23 @@ export class ForwarderContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
/**
* Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting.
* If the transaction was mined, but reverted, an error is thrown.
* @param orders Array of order specifications used containing desired
* makerAsset and WETH as takerAsset.
* @param makerAssetFillAmount Desired amount of makerAsset to purchase.
* @param signatures Proofs that orders have been created by makers.
* @param feeOrders Array of order specifications containing ZRX as makerAsset
* and WETH as takerAsset. Used to purchase ZRX for primary order fees.
* @param feeSignatures Proofs that feeOrders have been created by makers.
* @param feePercentage Percentage of WETH sold that will payed as fee to
* forwarding contract feeRecipient.
* @param feeRecipient Address that will receive ETH when orders are filled.
* @param txData Additional data for transaction
* @param pollingIntervalMs Interval at which to poll for success
* @returns A promise that resolves when the transaction is successful
*/
awaitTransactionSuccessAsync(
orders: Array<{
makerAddress: string;
@@ -177,6 +215,21 @@ export class ForwarderContract extends BaseContract {
})(),
);
},
/**
* Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments.
* @param orders Array of order specifications used containing desired
* makerAsset and WETH as takerAsset.
* @param makerAssetFillAmount Desired amount of makerAsset to purchase.
* @param signatures Proofs that orders have been created by makers.
* @param feeOrders Array of order specifications containing ZRX as makerAsset
* and WETH as takerAsset. Used to purchase ZRX for primary order fees.
* @param feeSignatures Proofs that feeOrders have been created by makers.
* @param feePercentage Percentage of WETH sold that will payed as fee to
* forwarding contract feeRecipient.
* @param feeRecipient Address that will receive ETH when orders are filled.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async estimateGasAsync(
orders: Array<{
makerAddress: string;
@@ -248,6 +301,22 @@ export class ForwarderContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @param orders Array of order specifications used containing desired
* makerAsset and WETH as takerAsset.
* @param makerAssetFillAmount Desired amount of makerAsset to purchase.
* @param signatures Proofs that orders have been created by makers.
* @param feeOrders Array of order specifications containing ZRX as makerAsset
* and WETH as takerAsset. Used to purchase ZRX for primary order fees.
* @param feeSignatures Proofs that feeOrders have been created by makers.
* @param feePercentage Percentage of WETH sold that will payed as fee to
* forwarding contract feeRecipient.
* @param feeRecipient Address that will receive ETH when orders are filled.
* @returns Amounts filled and fees paid by maker and taker for both sets of orders.
*/
async callAsync(
orders: Array<{
makerAddress: string;
@@ -365,6 +434,21 @@ export class ForwarderContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
* @param orders Array of order specifications used containing desired
* makerAsset and WETH as takerAsset.
* @param makerAssetFillAmount Desired amount of makerAsset to purchase.
* @param signatures Proofs that orders have been created by makers.
* @param feeOrders Array of order specifications containing ZRX as makerAsset
* and WETH as takerAsset. Used to purchase ZRX for primary order fees.
* @param feeSignatures Proofs that feeOrders have been created by makers.
* @param feePercentage Percentage of WETH sold that will payed as fee to
* forwarding contract feeRecipient.
* @param feeRecipient Address that will receive ETH when orders are filled.
*/
getABIEncodedTransactionData(
orders: Array<{
makerAddress: string;
@@ -422,8 +506,99 @@ export class ForwarderContract extends BaseContract {
);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(
callData: string,
): [
{
makerAssetFilledAmount: BigNumber;
takerAssetFilledAmount: BigNumber;
makerFeePaid: BigNumber;
takerFeePaid: BigNumber;
},
{
makerAssetFilledAmount: BigNumber;
takerAssetFilledAmount: BigNumber;
makerFeePaid: BigNumber;
takerFeePaid: BigNumber;
}
] {
const self = (this as any) as ForwarderContract;
const abiEncoder = self._lookupAbiEncoder(
'marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)',
);
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<
[
{
makerAssetFilledAmount: BigNumber;
takerAssetFilledAmount: BigNumber;
makerFeePaid: BigNumber;
takerFeePaid: BigNumber;
},
{
makerAssetFilledAmount: BigNumber;
takerAssetFilledAmount: BigNumber;
makerFeePaid: BigNumber;
takerFeePaid: BigNumber;
}
]
>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(
returnData: string,
): [
{
makerAssetFilledAmount: BigNumber;
takerAssetFilledAmount: BigNumber;
makerFeePaid: BigNumber;
takerFeePaid: BigNumber;
},
{
makerAssetFilledAmount: BigNumber;
takerAssetFilledAmount: BigNumber;
makerFeePaid: BigNumber;
takerFeePaid: BigNumber;
}
] {
const self = (this as any) as ForwarderContract;
const abiEncoder = self._lookupAbiEncoder(
'marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)',
);
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<
[
{
makerAssetFilledAmount: BigNumber;
takerAssetFilledAmount: BigNumber;
makerFeePaid: BigNumber;
takerFeePaid: BigNumber;
},
{
makerAssetFilledAmount: BigNumber;
takerAssetFilledAmount: BigNumber;
makerFeePaid: BigNumber;
takerFeePaid: BigNumber;
}
]
>(returnData);
return abiDecodedReturnData;
},
};
/**
* Withdraws assets from this contract. The contract requires a ZRX balance in order to
* function optimally, and this function allows the ZRX to be withdrawn by owner. It may also be
* used to withdraw assets that were accidentally sent to this contract.
*/
public withdrawAsset = {
/**
* Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write
* Ethereum operation and will cost gas.
* @param assetData Byte array encoded for the respective asset proxy.
* @param amount Amount of ERC20 token to withdraw.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async sendTransactionAsync(
assetData: string,
amount: BigNumber,
@@ -449,6 +624,15 @@ export class ForwarderContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
/**
* Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting.
* If the transaction was mined, but reverted, an error is thrown.
* @param assetData Byte array encoded for the respective asset proxy.
* @param amount Amount of ERC20 token to withdraw.
* @param txData Additional data for transaction
* @param pollingIntervalMs Interval at which to poll for success
* @returns A promise that resolves when the transaction is successful
*/
awaitTransactionSuccessAsync(
assetData: string,
amount: BigNumber,
@@ -472,6 +656,13 @@ export class ForwarderContract extends BaseContract {
})(),
);
},
/**
* Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments.
* @param assetData Byte array encoded for the respective asset proxy.
* @param amount Amount of ERC20 token to withdraw.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async estimateGasAsync(
assetData: string,
amount: BigNumber,
@@ -496,6 +687,13 @@ export class ForwarderContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @param assetData Byte array encoded for the respective asset proxy.
* @param amount Amount of ERC20 token to withdraw.
*/
async callAsync(
assetData: string,
amount: BigNumber,
@@ -534,6 +732,13 @@ export class ForwarderContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
* @param assetData Byte array encoded for the respective asset proxy.
* @param amount Amount of ERC20 token to withdraw.
*/
getABIEncodedTransactionData(assetData: string, amount: BigNumber): string {
assert.isString('assetData', assetData);
assert.isBigNumber('amount', amount);
@@ -544,8 +749,27 @@ export class ForwarderContract extends BaseContract {
]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): void {
const self = (this as any) as ForwarderContract;
const abiEncoder = self._lookupAbiEncoder('withdrawAsset(bytes,uint256)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<void>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): void {
const self = (this as any) as ForwarderContract;
const abiEncoder = self._lookupAbiEncoder('withdrawAsset(bytes,uint256)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
};
public owner = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
*/
async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<string> {
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
schemas.addressSchema,
@@ -577,13 +801,53 @@ export class ForwarderContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(): string {
const self = (this as any) as ForwarderContract;
const abiEncodedTransactionData = self._strictEncodeArguments('owner()', []);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): string {
const self = (this as any) as ForwarderContract;
const abiEncoder = self._lookupAbiEncoder('owner()');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<string>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): string {
const self = (this as any) as ForwarderContract;
const abiEncoder = self._lookupAbiEncoder('owner()');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<string>(returnData);
return abiDecodedReturnData;
},
};
/**
* Purchases as much of orders' makerAssets as possible by selling up to 95% of transaction's ETH value.
* Any ZRX required to pay fees for primary orders will automatically be purchased by this contract.
* 5% of ETH value is reserved for paying fees to order feeRecipients (in ZRX) and forwarding contract feeRecipient (in ETH).
* Any ETH not spent will be refunded to sender.
*/
public marketSellOrdersWithEth = {
/**
* Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write
* Ethereum operation and will cost gas.
* @param orders Array of order specifications used containing desired
* makerAsset and WETH as takerAsset.
* @param signatures Proofs that orders have been created by makers.
* @param feeOrders Array of order specifications containing ZRX as makerAsset
* and WETH as takerAsset. Used to purchase ZRX for primary order fees.
* @param feeSignatures Proofs that feeOrders have been created by makers.
* @param feePercentage Percentage of WETH sold that will payed as fee to
* forwarding contract feeRecipient.
* @param feeRecipient Address that will receive ETH when orders are filled.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async sendTransactionAsync(
orders: Array<{
makerAddress: string;
@@ -654,6 +918,22 @@ export class ForwarderContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
/**
* Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting.
* If the transaction was mined, but reverted, an error is thrown.
* @param orders Array of order specifications used containing desired
* makerAsset and WETH as takerAsset.
* @param signatures Proofs that orders have been created by makers.
* @param feeOrders Array of order specifications containing ZRX as makerAsset
* and WETH as takerAsset. Used to purchase ZRX for primary order fees.
* @param feeSignatures Proofs that feeOrders have been created by makers.
* @param feePercentage Percentage of WETH sold that will payed as fee to
* forwarding contract feeRecipient.
* @param feeRecipient Address that will receive ETH when orders are filled.
* @param txData Additional data for transaction
* @param pollingIntervalMs Interval at which to poll for success
* @returns A promise that resolves when the transaction is successful
*/
awaitTransactionSuccessAsync(
orders: Array<{
makerAddress: string;
@@ -719,6 +999,20 @@ export class ForwarderContract extends BaseContract {
})(),
);
},
/**
* Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments.
* @param orders Array of order specifications used containing desired
* makerAsset and WETH as takerAsset.
* @param signatures Proofs that orders have been created by makers.
* @param feeOrders Array of order specifications containing ZRX as makerAsset
* and WETH as takerAsset. Used to purchase ZRX for primary order fees.
* @param feeSignatures Proofs that feeOrders have been created by makers.
* @param feePercentage Percentage of WETH sold that will payed as fee to
* forwarding contract feeRecipient.
* @param feeRecipient Address that will receive ETH when orders are filled.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async estimateGasAsync(
orders: Array<{
makerAddress: string;
@@ -780,6 +1074,21 @@ export class ForwarderContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @param orders Array of order specifications used containing desired
* makerAsset and WETH as takerAsset.
* @param signatures Proofs that orders have been created by makers.
* @param feeOrders Array of order specifications containing ZRX as makerAsset
* and WETH as takerAsset. Used to purchase ZRX for primary order fees.
* @param feeSignatures Proofs that feeOrders have been created by makers.
* @param feePercentage Percentage of WETH sold that will payed as fee to
* forwarding contract feeRecipient.
* @param feeRecipient Address that will receive ETH when orders are filled.
* @returns Amounts filled and fees paid by maker and taker for both sets of orders.
*/
async callAsync(
orders: Array<{
makerAddress: string;
@@ -887,6 +1196,20 @@ export class ForwarderContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
* @param orders Array of order specifications used containing desired
* makerAsset and WETH as takerAsset.
* @param signatures Proofs that orders have been created by makers.
* @param feeOrders Array of order specifications containing ZRX as makerAsset
* and WETH as takerAsset. Used to purchase ZRX for primary order fees.
* @param feeSignatures Proofs that feeOrders have been created by makers.
* @param feePercentage Percentage of WETH sold that will payed as fee to
* forwarding contract feeRecipient.
* @param feeRecipient Address that will receive ETH when orders are filled.
*/
getABIEncodedTransactionData(
orders: Array<{
makerAddress: string;
@@ -934,8 +1257,92 @@ export class ForwarderContract extends BaseContract {
);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(
callData: string,
): [
{
makerAssetFilledAmount: BigNumber;
takerAssetFilledAmount: BigNumber;
makerFeePaid: BigNumber;
takerFeePaid: BigNumber;
},
{
makerAssetFilledAmount: BigNumber;
takerAssetFilledAmount: BigNumber;
makerFeePaid: BigNumber;
takerFeePaid: BigNumber;
}
] {
const self = (this as any) as ForwarderContract;
const abiEncoder = self._lookupAbiEncoder(
'marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)',
);
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<
[
{
makerAssetFilledAmount: BigNumber;
takerAssetFilledAmount: BigNumber;
makerFeePaid: BigNumber;
takerFeePaid: BigNumber;
},
{
makerAssetFilledAmount: BigNumber;
takerAssetFilledAmount: BigNumber;
makerFeePaid: BigNumber;
takerFeePaid: BigNumber;
}
]
>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(
returnData: string,
): [
{
makerAssetFilledAmount: BigNumber;
takerAssetFilledAmount: BigNumber;
makerFeePaid: BigNumber;
takerFeePaid: BigNumber;
},
{
makerAssetFilledAmount: BigNumber;
takerAssetFilledAmount: BigNumber;
makerFeePaid: BigNumber;
takerFeePaid: BigNumber;
}
] {
const self = (this as any) as ForwarderContract;
const abiEncoder = self._lookupAbiEncoder(
'marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)',
);
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<
[
{
makerAssetFilledAmount: BigNumber;
takerAssetFilledAmount: BigNumber;
makerFeePaid: BigNumber;
takerFeePaid: BigNumber;
},
{
makerAssetFilledAmount: BigNumber;
takerAssetFilledAmount: BigNumber;
makerFeePaid: BigNumber;
takerFeePaid: BigNumber;
}
]
>(returnData);
return abiDecodedReturnData;
},
};
public transferOwnership = {
/**
* Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write
* Ethereum operation and will cost gas.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async sendTransactionAsync(newOwner: string, txData?: Partial<TxData> | undefined): Promise<string> {
assert.isString('newOwner', newOwner);
const self = (this as any) as ForwarderContract;
@@ -956,6 +1363,13 @@ export class ForwarderContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
/**
* Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting.
* If the transaction was mined, but reverted, an error is thrown.
* @param txData Additional data for transaction
* @param pollingIntervalMs Interval at which to poll for success
* @returns A promise that resolves when the transaction is successful
*/
awaitTransactionSuccessAsync(
newOwner: string,
txData?: Partial<TxData>,
@@ -977,6 +1391,11 @@ export class ForwarderContract extends BaseContract {
})(),
);
},
/**
* Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async estimateGasAsync(newOwner: string, txData?: Partial<TxData> | undefined): Promise<number> {
assert.isString('newOwner', newOwner);
const self = (this as any) as ForwarderContract;
@@ -996,6 +1415,11 @@ export class ForwarderContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
*/
async callAsync(newOwner: string, callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<void> {
assert.isString('newOwner', newOwner);
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
@@ -1028,6 +1452,11 @@ export class ForwarderContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(newOwner: string): string {
assert.isString('newOwner', newOwner);
const self = (this as any) as ForwarderContract;
@@ -1036,6 +1465,20 @@ export class ForwarderContract extends BaseContract {
]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): void {
const self = (this as any) as ForwarderContract;
const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<void>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): void {
const self = (this as any) as ForwarderContract;
const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
};
public static async deployFrom0xArtifactAsync(
artifact: ContractArtifact | SimpleContractArtifact,
@@ -1058,8 +1501,10 @@ export class ForwarderContract extends BaseContract {
const bytecode = artifact.compilerOutput.evm.bytecode.object;
const abi = artifact.compilerOutput.abi;
const logDecodeDependenciesAbiOnly: { [contractName: string]: ContractAbi } = {};
for (const key of Object.keys(logDecodeDependencies)) {
logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi;
if (Object.keys(logDecodeDependencies) !== undefined) {
for (const key of Object.keys(logDecodeDependencies)) {
logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi;
}
}
return ForwarderContract.deployAsync(
bytecode,

View File

@@ -27,7 +27,17 @@ import * as ethers from 'ethers';
// tslint:disable:no-parameter-reassignment
// tslint:disable-next-line:class-name
export class IAssetProxyContract extends BaseContract {
/**
* Authorizes an address.
*/
public addAuthorizedAddress = {
/**
* Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write
* Ethereum operation and will cost gas.
* @param target Address to authorize.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async sendTransactionAsync(target: string, txData?: Partial<TxData> | undefined): Promise<string> {
assert.isString('target', target);
const self = (this as any) as IAssetProxyContract;
@@ -48,6 +58,14 @@ export class IAssetProxyContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
/**
* Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting.
* If the transaction was mined, but reverted, an error is thrown.
* @param target Address to authorize.
* @param txData Additional data for transaction
* @param pollingIntervalMs Interval at which to poll for success
* @returns A promise that resolves when the transaction is successful
*/
awaitTransactionSuccessAsync(
target: string,
txData?: Partial<TxData>,
@@ -69,6 +87,12 @@ export class IAssetProxyContract extends BaseContract {
})(),
);
},
/**
* Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments.
* @param target Address to authorize.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async estimateGasAsync(target: string, txData?: Partial<TxData> | undefined): Promise<number> {
assert.isString('target', target);
const self = (this as any) as IAssetProxyContract;
@@ -88,6 +112,12 @@ export class IAssetProxyContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @param target Address to authorize.
*/
async callAsync(target: string, callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<void> {
assert.isString('target', target);
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
@@ -120,6 +150,12 @@ export class IAssetProxyContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
* @param target Address to authorize.
*/
getABIEncodedTransactionData(target: string): string {
assert.isString('target', target);
const self = (this as any) as IAssetProxyContract;
@@ -128,8 +164,32 @@ export class IAssetProxyContract extends BaseContract {
]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): void {
const self = (this as any) as IAssetProxyContract;
const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<void>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): void {
const self = (this as any) as IAssetProxyContract;
const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
};
/**
* Removes authorizion of an address.
*/
public removeAuthorizedAddress = {
/**
* Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write
* Ethereum operation and will cost gas.
* @param target Address to remove authorization from.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async sendTransactionAsync(target: string, txData?: Partial<TxData> | undefined): Promise<string> {
assert.isString('target', target);
const self = (this as any) as IAssetProxyContract;
@@ -150,6 +210,14 @@ export class IAssetProxyContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
/**
* Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting.
* If the transaction was mined, but reverted, an error is thrown.
* @param target Address to remove authorization from.
* @param txData Additional data for transaction
* @param pollingIntervalMs Interval at which to poll for success
* @returns A promise that resolves when the transaction is successful
*/
awaitTransactionSuccessAsync(
target: string,
txData?: Partial<TxData>,
@@ -171,6 +239,12 @@ export class IAssetProxyContract extends BaseContract {
})(),
);
},
/**
* Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments.
* @param target Address to remove authorization from.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async estimateGasAsync(target: string, txData?: Partial<TxData> | undefined): Promise<number> {
assert.isString('target', target);
const self = (this as any) as IAssetProxyContract;
@@ -190,6 +264,12 @@ export class IAssetProxyContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @param target Address to remove authorization from.
*/
async callAsync(target: string, callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<void> {
assert.isString('target', target);
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
@@ -222,6 +302,12 @@ export class IAssetProxyContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
* @param target Address to remove authorization from.
*/
getABIEncodedTransactionData(target: string): string {
assert.isString('target', target);
const self = (this as any) as IAssetProxyContract;
@@ -230,8 +316,33 @@ export class IAssetProxyContract extends BaseContract {
]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): void {
const self = (this as any) as IAssetProxyContract;
const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<void>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): void {
const self = (this as any) as IAssetProxyContract;
const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
};
/**
* Removes authorizion of an address.
*/
public removeAuthorizedAddressAtIndex = {
/**
* Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write
* Ethereum operation and will cost gas.
* @param target Address to remove authorization from.
* @param index Index of target in authorities array.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async sendTransactionAsync(
target: string,
index: BigNumber,
@@ -260,6 +371,15 @@ export class IAssetProxyContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
/**
* Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting.
* If the transaction was mined, but reverted, an error is thrown.
* @param target Address to remove authorization from.
* @param index Index of target in authorities array.
* @param txData Additional data for transaction
* @param pollingIntervalMs Interval at which to poll for success
* @returns A promise that resolves when the transaction is successful
*/
awaitTransactionSuccessAsync(
target: string,
index: BigNumber,
@@ -287,6 +407,13 @@ export class IAssetProxyContract extends BaseContract {
})(),
);
},
/**
* Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments.
* @param target Address to remove authorization from.
* @param index Index of target in authorities array.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async estimateGasAsync(
target: string,
index: BigNumber,
@@ -314,6 +441,13 @@ export class IAssetProxyContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @param target Address to remove authorization from.
* @param index Index of target in authorities array.
*/
async callAsync(
target: string,
index: BigNumber,
@@ -355,6 +489,13 @@ export class IAssetProxyContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
* @param target Address to remove authorization from.
* @param index Index of target in authorities array.
*/
getABIEncodedTransactionData(target: string, index: BigNumber): string {
assert.isString('target', target);
assert.isBigNumber('index', index);
@@ -365,8 +506,35 @@ export class IAssetProxyContract extends BaseContract {
);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): void {
const self = (this as any) as IAssetProxyContract;
const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<void>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): void {
const self = (this as any) as IAssetProxyContract;
const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
};
/**
* Transfers assets. Either succeeds or throws.
*/
public transferFrom = {
/**
* Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write
* Ethereum operation and will cost gas.
* @param assetData Byte array encoded for the respective asset proxy.
* @param from Address to transfer asset from.
* @param to Address to transfer asset to.
* @param amount Amount of asset to transfer.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async sendTransactionAsync(
assetData: string,
from: string,
@@ -401,6 +569,17 @@ export class IAssetProxyContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
/**
* Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting.
* If the transaction was mined, but reverted, an error is thrown.
* @param assetData Byte array encoded for the respective asset proxy.
* @param from Address to transfer asset from.
* @param to Address to transfer asset to.
* @param amount Amount of asset to transfer.
* @param txData Additional data for transaction
* @param pollingIntervalMs Interval at which to poll for success
* @returns A promise that resolves when the transaction is successful
*/
awaitTransactionSuccessAsync(
assetData: string,
from: string,
@@ -434,6 +613,15 @@ export class IAssetProxyContract extends BaseContract {
})(),
);
},
/**
* Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments.
* @param assetData Byte array encoded for the respective asset proxy.
* @param from Address to transfer asset from.
* @param to Address to transfer asset to.
* @param amount Amount of asset to transfer.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async estimateGasAsync(
assetData: string,
from: string,
@@ -467,6 +655,15 @@ export class IAssetProxyContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @param assetData Byte array encoded for the respective asset proxy.
* @param from Address to transfer asset from.
* @param to Address to transfer asset to.
* @param amount Amount of asset to transfer.
*/
async callAsync(
assetData: string,
from: string,
@@ -514,6 +711,15 @@ export class IAssetProxyContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
* @param assetData Byte array encoded for the respective asset proxy.
* @param from Address to transfer asset from.
* @param to Address to transfer asset to.
* @param amount Amount of asset to transfer.
*/
getABIEncodedTransactionData(assetData: string, from: string, to: string, amount: BigNumber): string {
assert.isString('assetData', assetData);
assert.isString('from', from);
@@ -526,8 +732,31 @@ export class IAssetProxyContract extends BaseContract {
);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): void {
const self = (this as any) as IAssetProxyContract;
const abiEncoder = self._lookupAbiEncoder('transferFrom(bytes,address,address,uint256)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<void>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): void {
const self = (this as any) as IAssetProxyContract;
const abiEncoder = self._lookupAbiEncoder('transferFrom(bytes,address,address,uint256)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
};
/**
* Gets the proxy id associated with the proxy address.
*/
public getProxyId = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @returns Proxy id.
*/
async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<string> {
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
schemas.addressSchema,
@@ -559,13 +788,41 @@ export class IAssetProxyContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(): string {
const self = (this as any) as IAssetProxyContract;
const abiEncodedTransactionData = self._strictEncodeArguments('getProxyId()', []);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): string {
const self = (this as any) as IAssetProxyContract;
const abiEncoder = self._lookupAbiEncoder('getProxyId()');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<string>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): string {
const self = (this as any) as IAssetProxyContract;
const abiEncoder = self._lookupAbiEncoder('getProxyId()');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<string>(returnData);
return abiDecodedReturnData;
},
};
/**
* Gets all authorized addresses.
*/
public getAuthorizedAddresses = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @returns Array of authorized addresses.
*/
async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<string[]> {
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
schemas.addressSchema,
@@ -597,13 +854,38 @@ export class IAssetProxyContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(): string {
const self = (this as any) as IAssetProxyContract;
const abiEncodedTransactionData = self._strictEncodeArguments('getAuthorizedAddresses()', []);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): string[] {
const self = (this as any) as IAssetProxyContract;
const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<string[]>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): string[] {
const self = (this as any) as IAssetProxyContract;
const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<string[]>(returnData);
return abiDecodedReturnData;
},
};
public transferOwnership = {
/**
* Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write
* Ethereum operation and will cost gas.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async sendTransactionAsync(newOwner: string, txData?: Partial<TxData> | undefined): Promise<string> {
assert.isString('newOwner', newOwner);
const self = (this as any) as IAssetProxyContract;
@@ -624,6 +906,13 @@ export class IAssetProxyContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
/**
* Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting.
* If the transaction was mined, but reverted, an error is thrown.
* @param txData Additional data for transaction
* @param pollingIntervalMs Interval at which to poll for success
* @returns A promise that resolves when the transaction is successful
*/
awaitTransactionSuccessAsync(
newOwner: string,
txData?: Partial<TxData>,
@@ -645,6 +934,11 @@ export class IAssetProxyContract extends BaseContract {
})(),
);
},
/**
* Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async estimateGasAsync(newOwner: string, txData?: Partial<TxData> | undefined): Promise<number> {
assert.isString('newOwner', newOwner);
const self = (this as any) as IAssetProxyContract;
@@ -664,6 +958,11 @@ export class IAssetProxyContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
*/
async callAsync(newOwner: string, callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<void> {
assert.isString('newOwner', newOwner);
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
@@ -696,6 +995,11 @@ export class IAssetProxyContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(newOwner: string): string {
assert.isString('newOwner', newOwner);
const self = (this as any) as IAssetProxyContract;
@@ -704,6 +1008,20 @@ export class IAssetProxyContract extends BaseContract {
]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): void {
const self = (this as any) as IAssetProxyContract;
const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<void>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): void {
const self = (this as any) as IAssetProxyContract;
const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
};
public static async deployFrom0xArtifactAsync(
artifact: ContractArtifact | SimpleContractArtifact,
@@ -723,8 +1041,10 @@ export class IAssetProxyContract extends BaseContract {
const bytecode = artifact.compilerOutput.evm.bytecode.object;
const abi = artifact.compilerOutput.abi;
const logDecodeDependenciesAbiOnly: { [contractName: string]: ContractAbi } = {};
for (const key of Object.keys(logDecodeDependencies)) {
logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi;
if (Object.keys(logDecodeDependencies) !== undefined) {
for (const key of Object.keys(logDecodeDependencies)) {
logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi;
}
}
return IAssetProxyContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly);
}

View File

@@ -27,7 +27,19 @@ import * as ethers from 'ethers';
// tslint:disable:no-parameter-reassignment
// tslint:disable-next-line:class-name
export class IValidatorContract extends BaseContract {
/**
* Verifies that a signature is valid.
*/
public isValidSignature = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @param hash Message hash that is signed.
* @param signerAddress Address that should have signed the given hash.
* @param signature Proof of signing.
* @returns Validity of order signature.
*/
async callAsync(
hash: string,
signerAddress: string,
@@ -72,6 +84,14 @@ export class IValidatorContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
* @param hash Message hash that is signed.
* @param signerAddress Address that should have signed the given hash.
* @param signature Proof of signing.
*/
getABIEncodedTransactionData(hash: string, signerAddress: string, signature: string): string {
assert.isString('hash', hash);
assert.isString('signerAddress', signerAddress);
@@ -84,6 +104,20 @@ export class IValidatorContract extends BaseContract {
]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): boolean {
const self = (this as any) as IValidatorContract;
const abiEncoder = self._lookupAbiEncoder('isValidSignature(bytes32,address,bytes)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<boolean>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): boolean {
const self = (this as any) as IValidatorContract;
const abiEncoder = self._lookupAbiEncoder('isValidSignature(bytes32,address,bytes)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<boolean>(returnData);
return abiDecodedReturnData;
},
};
public static async deployFrom0xArtifactAsync(
artifact: ContractArtifact | SimpleContractArtifact,
@@ -103,8 +137,10 @@ export class IValidatorContract extends BaseContract {
const bytecode = artifact.compilerOutput.evm.bytecode.object;
const abi = artifact.compilerOutput.abi;
const logDecodeDependenciesAbiOnly: { [contractName: string]: ContractAbi } = {};
for (const key of Object.keys(logDecodeDependencies)) {
logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi;
if (Object.keys(logDecodeDependencies) !== undefined) {
for (const key of Object.keys(logDecodeDependencies)) {
logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi;
}
}
return IValidatorContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly);
}

View File

@@ -27,7 +27,18 @@ import * as ethers from 'ethers';
// tslint:disable:no-parameter-reassignment
// tslint:disable-next-line:class-name
export class IWalletContract extends BaseContract {
/**
* Verifies that a signature is valid.
*/
public isValidSignature = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @param hash Message hash that is signed.
* @param signature Proof of signing.
* @returns Validity of order signature.
*/
async callAsync(
hash: string,
signature: string,
@@ -66,6 +77,13 @@ export class IWalletContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
* @param hash Message hash that is signed.
* @param signature Proof of signing.
*/
getABIEncodedTransactionData(hash: string, signature: string): string {
assert.isString('hash', hash);
assert.isString('signature', signature);
@@ -76,6 +94,20 @@ export class IWalletContract extends BaseContract {
]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): boolean {
const self = (this as any) as IWalletContract;
const abiEncoder = self._lookupAbiEncoder('isValidSignature(bytes32,bytes)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<boolean>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): boolean {
const self = (this as any) as IWalletContract;
const abiEncoder = self._lookupAbiEncoder('isValidSignature(bytes32,bytes)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<boolean>(returnData);
return abiDecodedReturnData;
},
};
public static async deployFrom0xArtifactAsync(
artifact: ContractArtifact | SimpleContractArtifact,
@@ -95,8 +127,10 @@ export class IWalletContract extends BaseContract {
const bytecode = artifact.compilerOutput.evm.bytecode.object;
const abi = artifact.compilerOutput.abi;
const logDecodeDependenciesAbiOnly: { [contractName: string]: ContractAbi } = {};
for (const key of Object.keys(logDecodeDependencies)) {
logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi;
if (Object.keys(logDecodeDependencies) !== undefined) {
for (const key of Object.keys(logDecodeDependencies)) {
logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi;
}
}
return IWalletContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly);
}

View File

@@ -62,6 +62,11 @@ export interface MultiAssetProxyAssetProxyRegisteredEventArgs extends DecodedLog
// tslint:disable-next-line:class-name
export class MultiAssetProxyContract extends BaseContract {
public assetProxies = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
*/
async callAsync(index_0: string, callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<string> {
assert.isString('index_0', index_0);
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
@@ -94,14 +99,43 @@ export class MultiAssetProxyContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(index_0: string): string {
assert.isString('index_0', index_0);
const self = (this as any) as MultiAssetProxyContract;
const abiEncodedTransactionData = self._strictEncodeArguments('assetProxies(bytes4)', [index_0]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): string {
const self = (this as any) as MultiAssetProxyContract;
const abiEncoder = self._lookupAbiEncoder('assetProxies(bytes4)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<string>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): string {
const self = (this as any) as MultiAssetProxyContract;
const abiEncoder = self._lookupAbiEncoder('assetProxies(bytes4)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<string>(returnData);
return abiDecodedReturnData;
},
};
/**
* Authorizes an address.
*/
public addAuthorizedAddress = {
/**
* Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write
* Ethereum operation and will cost gas.
* @param target Address to authorize.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async sendTransactionAsync(target: string, txData?: Partial<TxData> | undefined): Promise<string> {
assert.isString('target', target);
const self = (this as any) as MultiAssetProxyContract;
@@ -122,6 +156,14 @@ export class MultiAssetProxyContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
/**
* Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting.
* If the transaction was mined, but reverted, an error is thrown.
* @param target Address to authorize.
* @param txData Additional data for transaction
* @param pollingIntervalMs Interval at which to poll for success
* @returns A promise that resolves when the transaction is successful
*/
awaitTransactionSuccessAsync(
target: string,
txData?: Partial<TxData>,
@@ -143,6 +185,12 @@ export class MultiAssetProxyContract extends BaseContract {
})(),
);
},
/**
* Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments.
* @param target Address to authorize.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async estimateGasAsync(target: string, txData?: Partial<TxData> | undefined): Promise<number> {
assert.isString('target', target);
const self = (this as any) as MultiAssetProxyContract;
@@ -162,6 +210,12 @@ export class MultiAssetProxyContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @param target Address to authorize.
*/
async callAsync(target: string, callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<void> {
assert.isString('target', target);
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
@@ -194,6 +248,12 @@ export class MultiAssetProxyContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
* @param target Address to authorize.
*/
getABIEncodedTransactionData(target: string): string {
assert.isString('target', target);
const self = (this as any) as MultiAssetProxyContract;
@@ -202,8 +262,27 @@ export class MultiAssetProxyContract extends BaseContract {
]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): void {
const self = (this as any) as MultiAssetProxyContract;
const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<void>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): void {
const self = (this as any) as MultiAssetProxyContract;
const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
};
public authorities = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
*/
async callAsync(
index_0: BigNumber,
callData: Partial<CallData> = {},
@@ -240,14 +319,43 @@ export class MultiAssetProxyContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(index_0: BigNumber): string {
assert.isBigNumber('index_0', index_0);
const self = (this as any) as MultiAssetProxyContract;
const abiEncodedTransactionData = self._strictEncodeArguments('authorities(uint256)', [index_0]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): string {
const self = (this as any) as MultiAssetProxyContract;
const abiEncoder = self._lookupAbiEncoder('authorities(uint256)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<string>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): string {
const self = (this as any) as MultiAssetProxyContract;
const abiEncoder = self._lookupAbiEncoder('authorities(uint256)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<string>(returnData);
return abiDecodedReturnData;
},
};
/**
* Gets an asset proxy.
*/
public getAssetProxy = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @param assetProxyId Id of the asset proxy.
* @returns The asset proxy registered to assetProxyId. Returns 0x0 if no proxy is registered.
*/
async callAsync(
assetProxyId: string,
callData: Partial<CallData> = {},
@@ -284,14 +392,44 @@ export class MultiAssetProxyContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
* @param assetProxyId Id of the asset proxy.
*/
getABIEncodedTransactionData(assetProxyId: string): string {
assert.isString('assetProxyId', assetProxyId);
const self = (this as any) as MultiAssetProxyContract;
const abiEncodedTransactionData = self._strictEncodeArguments('getAssetProxy(bytes4)', [assetProxyId]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): string {
const self = (this as any) as MultiAssetProxyContract;
const abiEncoder = self._lookupAbiEncoder('getAssetProxy(bytes4)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<string>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): string {
const self = (this as any) as MultiAssetProxyContract;
const abiEncoder = self._lookupAbiEncoder('getAssetProxy(bytes4)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<string>(returnData);
return abiDecodedReturnData;
},
};
/**
* Removes authorizion of an address.
*/
public removeAuthorizedAddress = {
/**
* Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write
* Ethereum operation and will cost gas.
* @param target Address to remove authorization from.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async sendTransactionAsync(target: string, txData?: Partial<TxData> | undefined): Promise<string> {
assert.isString('target', target);
const self = (this as any) as MultiAssetProxyContract;
@@ -312,6 +450,14 @@ export class MultiAssetProxyContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
/**
* Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting.
* If the transaction was mined, but reverted, an error is thrown.
* @param target Address to remove authorization from.
* @param txData Additional data for transaction
* @param pollingIntervalMs Interval at which to poll for success
* @returns A promise that resolves when the transaction is successful
*/
awaitTransactionSuccessAsync(
target: string,
txData?: Partial<TxData>,
@@ -333,6 +479,12 @@ export class MultiAssetProxyContract extends BaseContract {
})(),
);
},
/**
* Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments.
* @param target Address to remove authorization from.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async estimateGasAsync(target: string, txData?: Partial<TxData> | undefined): Promise<number> {
assert.isString('target', target);
const self = (this as any) as MultiAssetProxyContract;
@@ -352,6 +504,12 @@ export class MultiAssetProxyContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @param target Address to remove authorization from.
*/
async callAsync(target: string, callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<void> {
assert.isString('target', target);
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
@@ -384,6 +542,12 @@ export class MultiAssetProxyContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
* @param target Address to remove authorization from.
*/
getABIEncodedTransactionData(target: string): string {
assert.isString('target', target);
const self = (this as any) as MultiAssetProxyContract;
@@ -392,8 +556,27 @@ export class MultiAssetProxyContract extends BaseContract {
]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): void {
const self = (this as any) as MultiAssetProxyContract;
const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<void>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): void {
const self = (this as any) as MultiAssetProxyContract;
const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
};
public owner = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
*/
async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<string> {
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
schemas.addressSchema,
@@ -425,13 +608,43 @@ export class MultiAssetProxyContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(): string {
const self = (this as any) as MultiAssetProxyContract;
const abiEncodedTransactionData = self._strictEncodeArguments('owner()', []);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): string {
const self = (this as any) as MultiAssetProxyContract;
const abiEncoder = self._lookupAbiEncoder('owner()');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<string>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): string {
const self = (this as any) as MultiAssetProxyContract;
const abiEncoder = self._lookupAbiEncoder('owner()');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<string>(returnData);
return abiDecodedReturnData;
},
};
/**
* Removes authorizion of an address.
*/
public removeAuthorizedAddressAtIndex = {
/**
* Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write
* Ethereum operation and will cost gas.
* @param target Address to remove authorization from.
* @param index Index of target in authorities array.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async sendTransactionAsync(
target: string,
index: BigNumber,
@@ -460,6 +673,15 @@ export class MultiAssetProxyContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
/**
* Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting.
* If the transaction was mined, but reverted, an error is thrown.
* @param target Address to remove authorization from.
* @param index Index of target in authorities array.
* @param txData Additional data for transaction
* @param pollingIntervalMs Interval at which to poll for success
* @returns A promise that resolves when the transaction is successful
*/
awaitTransactionSuccessAsync(
target: string,
index: BigNumber,
@@ -487,6 +709,13 @@ export class MultiAssetProxyContract extends BaseContract {
})(),
);
},
/**
* Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments.
* @param target Address to remove authorization from.
* @param index Index of target in authorities array.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async estimateGasAsync(
target: string,
index: BigNumber,
@@ -514,6 +743,13 @@ export class MultiAssetProxyContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @param target Address to remove authorization from.
* @param index Index of target in authorities array.
*/
async callAsync(
target: string,
index: BigNumber,
@@ -555,6 +791,13 @@ export class MultiAssetProxyContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
* @param target Address to remove authorization from.
* @param index Index of target in authorities array.
*/
getABIEncodedTransactionData(target: string, index: BigNumber): string {
assert.isString('target', target);
assert.isBigNumber('index', index);
@@ -565,8 +808,31 @@ export class MultiAssetProxyContract extends BaseContract {
);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): void {
const self = (this as any) as MultiAssetProxyContract;
const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<void>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): void {
const self = (this as any) as MultiAssetProxyContract;
const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
};
/**
* Gets the proxy id associated with the proxy address.
*/
public getProxyId = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @returns Proxy id.
*/
async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<string> {
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
schemas.addressSchema,
@@ -598,13 +864,37 @@ export class MultiAssetProxyContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(): string {
const self = (this as any) as MultiAssetProxyContract;
const abiEncodedTransactionData = self._strictEncodeArguments('getProxyId()', []);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): string {
const self = (this as any) as MultiAssetProxyContract;
const abiEncoder = self._lookupAbiEncoder('getProxyId()');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<string>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): string {
const self = (this as any) as MultiAssetProxyContract;
const abiEncoder = self._lookupAbiEncoder('getProxyId()');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<string>(returnData);
return abiDecodedReturnData;
},
};
public authorized = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
*/
async callAsync(
index_0: string,
callData: Partial<CallData> = {},
@@ -641,6 +931,11 @@ export class MultiAssetProxyContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(index_0: string): string {
assert.isString('index_0', index_0);
const self = (this as any) as MultiAssetProxyContract;
@@ -649,8 +944,33 @@ export class MultiAssetProxyContract extends BaseContract {
]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): boolean {
const self = (this as any) as MultiAssetProxyContract;
const abiEncoder = self._lookupAbiEncoder('authorized(address)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<boolean>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): boolean {
const self = (this as any) as MultiAssetProxyContract;
const abiEncoder = self._lookupAbiEncoder('authorized(address)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<boolean>(returnData);
return abiDecodedReturnData;
},
};
/**
* Registers an asset proxy to its asset proxy id.
* Once an asset proxy is registered, it cannot be unregistered.
*/
public registerAssetProxy = {
/**
* Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write
* Ethereum operation and will cost gas.
* @param assetProxy Address of new asset proxy to register.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async sendTransactionAsync(assetProxy: string, txData?: Partial<TxData> | undefined): Promise<string> {
assert.isString('assetProxy', assetProxy);
const self = (this as any) as MultiAssetProxyContract;
@@ -671,6 +991,14 @@ export class MultiAssetProxyContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
/**
* Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting.
* If the transaction was mined, but reverted, an error is thrown.
* @param assetProxy Address of new asset proxy to register.
* @param txData Additional data for transaction
* @param pollingIntervalMs Interval at which to poll for success
* @returns A promise that resolves when the transaction is successful
*/
awaitTransactionSuccessAsync(
assetProxy: string,
txData?: Partial<TxData>,
@@ -692,6 +1020,12 @@ export class MultiAssetProxyContract extends BaseContract {
})(),
);
},
/**
* Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments.
* @param assetProxy Address of new asset proxy to register.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async estimateGasAsync(assetProxy: string, txData?: Partial<TxData> | undefined): Promise<number> {
assert.isString('assetProxy', assetProxy);
const self = (this as any) as MultiAssetProxyContract;
@@ -711,6 +1045,12 @@ export class MultiAssetProxyContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @param assetProxy Address of new asset proxy to register.
*/
async callAsync(
assetProxy: string,
callData: Partial<CallData> = {},
@@ -747,6 +1087,12 @@ export class MultiAssetProxyContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
* @param assetProxy Address of new asset proxy to register.
*/
getABIEncodedTransactionData(assetProxy: string): string {
assert.isString('assetProxy', assetProxy);
const self = (this as any) as MultiAssetProxyContract;
@@ -755,8 +1101,31 @@ export class MultiAssetProxyContract extends BaseContract {
]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): void {
const self = (this as any) as MultiAssetProxyContract;
const abiEncoder = self._lookupAbiEncoder('registerAssetProxy(address)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<void>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): void {
const self = (this as any) as MultiAssetProxyContract;
const abiEncoder = self._lookupAbiEncoder('registerAssetProxy(address)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
};
/**
* Gets all authorized addresses.
*/
public getAuthorizedAddresses = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @returns Array of authorized addresses.
*/
async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<string[]> {
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
schemas.addressSchema,
@@ -788,13 +1157,38 @@ export class MultiAssetProxyContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(): string {
const self = (this as any) as MultiAssetProxyContract;
const abiEncodedTransactionData = self._strictEncodeArguments('getAuthorizedAddresses()', []);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): string[] {
const self = (this as any) as MultiAssetProxyContract;
const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<string[]>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): string[] {
const self = (this as any) as MultiAssetProxyContract;
const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<string[]>(returnData);
return abiDecodedReturnData;
},
};
public transferOwnership = {
/**
* Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write
* Ethereum operation and will cost gas.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async sendTransactionAsync(newOwner: string, txData?: Partial<TxData> | undefined): Promise<string> {
assert.isString('newOwner', newOwner);
const self = (this as any) as MultiAssetProxyContract;
@@ -815,6 +1209,13 @@ export class MultiAssetProxyContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
/**
* Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting.
* If the transaction was mined, but reverted, an error is thrown.
* @param txData Additional data for transaction
* @param pollingIntervalMs Interval at which to poll for success
* @returns A promise that resolves when the transaction is successful
*/
awaitTransactionSuccessAsync(
newOwner: string,
txData?: Partial<TxData>,
@@ -836,6 +1237,11 @@ export class MultiAssetProxyContract extends BaseContract {
})(),
);
},
/**
* Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async estimateGasAsync(newOwner: string, txData?: Partial<TxData> | undefined): Promise<number> {
assert.isString('newOwner', newOwner);
const self = (this as any) as MultiAssetProxyContract;
@@ -855,6 +1261,11 @@ export class MultiAssetProxyContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
*/
async callAsync(newOwner: string, callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<void> {
assert.isString('newOwner', newOwner);
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
@@ -887,6 +1298,11 @@ export class MultiAssetProxyContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(newOwner: string): string {
assert.isString('newOwner', newOwner);
const self = (this as any) as MultiAssetProxyContract;
@@ -895,6 +1311,20 @@ export class MultiAssetProxyContract extends BaseContract {
]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): void {
const self = (this as any) as MultiAssetProxyContract;
const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<void>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): void {
const self = (this as any) as MultiAssetProxyContract;
const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
};
private readonly _subscriptionManager: SubscriptionManager<MultiAssetProxyEventArgs, MultiAssetProxyEvents>;
public static async deployFrom0xArtifactAsync(
@@ -915,8 +1345,10 @@ export class MultiAssetProxyContract extends BaseContract {
const bytecode = artifact.compilerOutput.evm.bytecode.object;
const abi = artifact.compilerOutput.abi;
const logDecodeDependenciesAbiOnly: { [contractName: string]: ContractAbi } = {};
for (const key of Object.keys(logDecodeDependencies)) {
logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi;
if (Object.keys(logDecodeDependencies) !== undefined) {
for (const key of Object.keys(logDecodeDependencies)) {
logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi;
}
}
return MultiAssetProxyContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly);
}
@@ -1222,11 +1654,11 @@ export class MultiAssetProxyContract extends BaseContract {
}
/**
* Subscribe to an event type emitted by the MultiAssetProxy contract.
* @param eventName The MultiAssetProxy contract event you would like to subscribe to.
* @param indexFilterValues An object where the keys are indexed args returned by the event and
* the value is the value you are interested in. E.g `{maker: aUserAddressHex}`
* @param callback Callback that gets called when a log is added/removed
* @param isVerbose Enable verbose subscription warnings (e.g recoverable network issues encountered)
* @param eventName The MultiAssetProxy contract event you would like to subscribe to.
* @param indexFilterValues An object where the keys are indexed args returned by the event and
* the value is the value you are interested in. E.g `{maker: aUserAddressHex}`
* @param callback Callback that gets called when a log is added/removed
* @param isVerbose Enable verbose subscription warnings (e.g recoverable network issues encountered)
* @return Subscription token used later to unsubscribe
*/
public subscribe<ArgsType extends MultiAssetProxyEventArgs>(
@@ -1252,7 +1684,7 @@ export class MultiAssetProxyContract extends BaseContract {
}
/**
* Cancel a subscription
* @param subscriptionToken Subscription token returned by `subscribe()`
* @param subscriptionToken Subscription token returned by `subscribe()`
*/
public unsubscribe(subscriptionToken: string): void {
this._subscriptionManager.unsubscribe(subscriptionToken);
@@ -1265,11 +1697,11 @@ export class MultiAssetProxyContract extends BaseContract {
}
/**
* Gets historical logs without creating a subscription
* @param eventName The MultiAssetProxy contract event you would like to subscribe to.
* @param blockRange Block range to get logs from.
* @param indexFilterValues An object where the keys are indexed args returned by the event and
* the value is the value you are interested in. E.g `{_from: aUserAddressHex}`
* @return Array of logs that match the parameters
* @param eventName The MultiAssetProxy contract event you would like to subscribe to.
* @param blockRange Block range to get logs from.
* @param indexFilterValues An object where the keys are indexed args returned by the event and
* the value is the value you are interested in. E.g `{_from: aUserAddressHex}`
* @return Array of logs that match the parameters
*/
public async getLogsAsync<ArgsType extends MultiAssetProxyEventArgs>(
eventName: MultiAssetProxyEvents,

View File

@@ -28,6 +28,11 @@ import * as ethers from 'ethers';
// tslint:disable-next-line:class-name
export class OrderValidatorContract extends BaseContract {
public getOrderAndTraderInfo = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
*/
async callAsync(
order: {
makerAddress: string;
@@ -111,6 +116,11 @@ export class OrderValidatorContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(
order: {
makerAddress: string;
@@ -136,8 +146,87 @@ export class OrderValidatorContract extends BaseContract {
);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(
callData: string,
): [
{ orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber },
{
makerBalance: BigNumber;
makerAllowance: BigNumber;
takerBalance: BigNumber;
takerAllowance: BigNumber;
makerZrxBalance: BigNumber;
makerZrxAllowance: BigNumber;
takerZrxBalance: BigNumber;
takerZrxAllowance: BigNumber;
}
] {
const self = (this as any) as OrderValidatorContract;
const abiEncoder = self._lookupAbiEncoder(
'getOrderAndTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)',
);
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<
[
{ orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber },
{
makerBalance: BigNumber;
makerAllowance: BigNumber;
takerBalance: BigNumber;
takerAllowance: BigNumber;
makerZrxBalance: BigNumber;
makerZrxAllowance: BigNumber;
takerZrxBalance: BigNumber;
takerZrxAllowance: BigNumber;
}
]
>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(
returnData: string,
): [
{ orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber },
{
makerBalance: BigNumber;
makerAllowance: BigNumber;
takerBalance: BigNumber;
takerAllowance: BigNumber;
makerZrxBalance: BigNumber;
makerZrxAllowance: BigNumber;
takerZrxBalance: BigNumber;
takerZrxAllowance: BigNumber;
}
] {
const self = (this as any) as OrderValidatorContract;
const abiEncoder = self._lookupAbiEncoder(
'getOrderAndTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)',
);
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<
[
{ orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber },
{
makerBalance: BigNumber;
makerAllowance: BigNumber;
takerBalance: BigNumber;
takerAllowance: BigNumber;
makerZrxBalance: BigNumber;
makerZrxAllowance: BigNumber;
takerZrxBalance: BigNumber;
takerZrxAllowance: BigNumber;
}
]
>(returnData);
return abiDecodedReturnData;
},
};
public getBalanceAndAllowance = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
*/
async callAsync(
target: string,
assetData: string,
@@ -179,6 +268,11 @@ export class OrderValidatorContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(target: string, assetData: string): string {
assert.isString('target', target);
assert.isString('assetData', assetData);
@@ -189,8 +283,27 @@ export class OrderValidatorContract extends BaseContract {
]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): [BigNumber, BigNumber] {
const self = (this as any) as OrderValidatorContract;
const abiEncoder = self._lookupAbiEncoder('getBalanceAndAllowance(address,bytes)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<[BigNumber, BigNumber]>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): [BigNumber, BigNumber] {
const self = (this as any) as OrderValidatorContract;
const abiEncoder = self._lookupAbiEncoder('getBalanceAndAllowance(address,bytes)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<[BigNumber, BigNumber]>(returnData);
return abiDecodedReturnData;
},
};
public getOrdersAndTradersInfo = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
*/
async callAsync(
orders: Array<{
makerAddress: string;
@@ -275,6 +388,11 @@ export class OrderValidatorContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(
orders: Array<{
makerAddress: string;
@@ -301,8 +419,87 @@ export class OrderValidatorContract extends BaseContract {
);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(
callData: string,
): [
Array<{ orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber }>,
Array<{
makerBalance: BigNumber;
makerAllowance: BigNumber;
takerBalance: BigNumber;
takerAllowance: BigNumber;
makerZrxBalance: BigNumber;
makerZrxAllowance: BigNumber;
takerZrxBalance: BigNumber;
takerZrxAllowance: BigNumber;
}>
] {
const self = (this as any) as OrderValidatorContract;
const abiEncoder = self._lookupAbiEncoder(
'getOrdersAndTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])',
);
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<
[
Array<{ orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber }>,
Array<{
makerBalance: BigNumber;
makerAllowance: BigNumber;
takerBalance: BigNumber;
takerAllowance: BigNumber;
makerZrxBalance: BigNumber;
makerZrxAllowance: BigNumber;
takerZrxBalance: BigNumber;
takerZrxAllowance: BigNumber;
}>
]
>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(
returnData: string,
): [
Array<{ orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber }>,
Array<{
makerBalance: BigNumber;
makerAllowance: BigNumber;
takerBalance: BigNumber;
takerAllowance: BigNumber;
makerZrxBalance: BigNumber;
makerZrxAllowance: BigNumber;
takerZrxBalance: BigNumber;
takerZrxAllowance: BigNumber;
}>
] {
const self = (this as any) as OrderValidatorContract;
const abiEncoder = self._lookupAbiEncoder(
'getOrdersAndTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])',
);
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<
[
Array<{ orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber }>,
Array<{
makerBalance: BigNumber;
makerAllowance: BigNumber;
takerBalance: BigNumber;
takerAllowance: BigNumber;
makerZrxBalance: BigNumber;
makerZrxAllowance: BigNumber;
takerZrxBalance: BigNumber;
takerZrxAllowance: BigNumber;
}>
]
>(returnData);
return abiDecodedReturnData;
},
};
public getTradersInfo = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
*/
async callAsync(
orders: Array<{
makerAddress: string;
@@ -381,6 +578,11 @@ export class OrderValidatorContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(
orders: Array<{
makerAddress: string;
@@ -407,8 +609,75 @@ export class OrderValidatorContract extends BaseContract {
);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(
callData: string,
): Array<{
makerBalance: BigNumber;
makerAllowance: BigNumber;
takerBalance: BigNumber;
takerAllowance: BigNumber;
makerZrxBalance: BigNumber;
makerZrxAllowance: BigNumber;
takerZrxBalance: BigNumber;
takerZrxAllowance: BigNumber;
}> {
const self = (this as any) as OrderValidatorContract;
const abiEncoder = self._lookupAbiEncoder(
'getTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])',
);
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<
Array<{
makerBalance: BigNumber;
makerAllowance: BigNumber;
takerBalance: BigNumber;
takerAllowance: BigNumber;
makerZrxBalance: BigNumber;
makerZrxAllowance: BigNumber;
takerZrxBalance: BigNumber;
takerZrxAllowance: BigNumber;
}>
>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(
returnData: string,
): Array<{
makerBalance: BigNumber;
makerAllowance: BigNumber;
takerBalance: BigNumber;
takerAllowance: BigNumber;
makerZrxBalance: BigNumber;
makerZrxAllowance: BigNumber;
takerZrxBalance: BigNumber;
takerZrxAllowance: BigNumber;
}> {
const self = (this as any) as OrderValidatorContract;
const abiEncoder = self._lookupAbiEncoder(
'getTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])',
);
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<
Array<{
makerBalance: BigNumber;
makerAllowance: BigNumber;
takerBalance: BigNumber;
takerAllowance: BigNumber;
makerZrxBalance: BigNumber;
makerZrxAllowance: BigNumber;
takerZrxBalance: BigNumber;
takerZrxAllowance: BigNumber;
}>
>(returnData);
return abiDecodedReturnData;
},
};
public getERC721TokenOwner = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
*/
async callAsync(
token: string,
tokenId: BigNumber,
@@ -450,6 +719,11 @@ export class OrderValidatorContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(token: string, tokenId: BigNumber): string {
assert.isString('token', token);
assert.isBigNumber('tokenId', tokenId);
@@ -460,8 +734,27 @@ export class OrderValidatorContract extends BaseContract {
]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): string {
const self = (this as any) as OrderValidatorContract;
const abiEncoder = self._lookupAbiEncoder('getERC721TokenOwner(address,uint256)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<string>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): string {
const self = (this as any) as OrderValidatorContract;
const abiEncoder = self._lookupAbiEncoder('getERC721TokenOwner(address,uint256)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<string>(returnData);
return abiDecodedReturnData;
},
};
public getBalancesAndAllowances = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
*/
async callAsync(
target: string,
assetData: string[],
@@ -503,6 +796,11 @@ export class OrderValidatorContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(target: string, assetData: string[]): string {
assert.isString('target', target);
assert.isArray('assetData', assetData);
@@ -513,8 +811,27 @@ export class OrderValidatorContract extends BaseContract {
]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): [BigNumber[], BigNumber[]] {
const self = (this as any) as OrderValidatorContract;
const abiEncoder = self._lookupAbiEncoder('getBalancesAndAllowances(address,bytes[])');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<[BigNumber[], BigNumber[]]>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): [BigNumber[], BigNumber[]] {
const self = (this as any) as OrderValidatorContract;
const abiEncoder = self._lookupAbiEncoder('getBalancesAndAllowances(address,bytes[])');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<[BigNumber[], BigNumber[]]>(returnData);
return abiDecodedReturnData;
},
};
public getTraderInfo = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
*/
async callAsync(
order: {
makerAddress: string;
@@ -588,6 +905,11 @@ export class OrderValidatorContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(
order: {
makerAddress: string;
@@ -613,6 +935,64 @@ export class OrderValidatorContract extends BaseContract {
);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(
callData: string,
): {
makerBalance: BigNumber;
makerAllowance: BigNumber;
takerBalance: BigNumber;
takerAllowance: BigNumber;
makerZrxBalance: BigNumber;
makerZrxAllowance: BigNumber;
takerZrxBalance: BigNumber;
takerZrxAllowance: BigNumber;
} {
const self = (this as any) as OrderValidatorContract;
const abiEncoder = self._lookupAbiEncoder(
'getTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)',
);
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<{
makerBalance: BigNumber;
makerAllowance: BigNumber;
takerBalance: BigNumber;
takerAllowance: BigNumber;
makerZrxBalance: BigNumber;
makerZrxAllowance: BigNumber;
takerZrxBalance: BigNumber;
takerZrxAllowance: BigNumber;
}>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(
returnData: string,
): {
makerBalance: BigNumber;
makerAllowance: BigNumber;
takerBalance: BigNumber;
takerAllowance: BigNumber;
makerZrxBalance: BigNumber;
makerZrxAllowance: BigNumber;
takerZrxBalance: BigNumber;
takerZrxAllowance: BigNumber;
} {
const self = (this as any) as OrderValidatorContract;
const abiEncoder = self._lookupAbiEncoder(
'getTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)',
);
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<{
makerBalance: BigNumber;
makerAllowance: BigNumber;
takerBalance: BigNumber;
takerAllowance: BigNumber;
makerZrxBalance: BigNumber;
makerZrxAllowance: BigNumber;
takerZrxBalance: BigNumber;
takerZrxAllowance: BigNumber;
}>(returnData);
return abiDecodedReturnData;
},
};
public static async deployFrom0xArtifactAsync(
artifact: ContractArtifact | SimpleContractArtifact,
@@ -634,8 +1014,10 @@ export class OrderValidatorContract extends BaseContract {
const bytecode = artifact.compilerOutput.evm.bytecode.object;
const abi = artifact.compilerOutput.abi;
const logDecodeDependenciesAbiOnly: { [contractName: string]: ContractAbi } = {};
for (const key of Object.keys(logDecodeDependencies)) {
logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi;
if (Object.keys(logDecodeDependencies) !== undefined) {
for (const key of Object.keys(logDecodeDependencies)) {
logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi;
}
}
return OrderValidatorContract.deployAsync(
bytecode,

View File

@@ -71,6 +71,11 @@ export interface WETH9WithdrawalEventArgs extends DecodedLogArgs {
// tslint:disable-next-line:class-name
export class WETH9Contract extends BaseContract {
public name = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
*/
async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<string> {
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
schemas.addressSchema,
@@ -102,13 +107,38 @@ export class WETH9Contract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(): string {
const self = (this as any) as WETH9Contract;
const abiEncodedTransactionData = self._strictEncodeArguments('name()', []);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): string {
const self = (this as any) as WETH9Contract;
const abiEncoder = self._lookupAbiEncoder('name()');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<string>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): string {
const self = (this as any) as WETH9Contract;
const abiEncoder = self._lookupAbiEncoder('name()');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<string>(returnData);
return abiDecodedReturnData;
},
};
public approve = {
/**
* Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write
* Ethereum operation and will cost gas.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async sendTransactionAsync(guy: string, wad: BigNumber, txData?: Partial<TxData> | undefined): Promise<string> {
assert.isString('guy', guy);
assert.isBigNumber('wad', wad);
@@ -130,6 +160,13 @@ export class WETH9Contract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
/**
* Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting.
* If the transaction was mined, but reverted, an error is thrown.
* @param txData Additional data for transaction
* @param pollingIntervalMs Interval at which to poll for success
* @returns A promise that resolves when the transaction is successful
*/
awaitTransactionSuccessAsync(
guy: string,
wad: BigNumber,
@@ -153,6 +190,11 @@ export class WETH9Contract extends BaseContract {
})(),
);
},
/**
* Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async estimateGasAsync(guy: string, wad: BigNumber, txData?: Partial<TxData> | undefined): Promise<number> {
assert.isString('guy', guy);
assert.isBigNumber('wad', wad);
@@ -173,6 +215,11 @@ export class WETH9Contract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
*/
async callAsync(
guy: string,
wad: BigNumber,
@@ -211,6 +258,11 @@ export class WETH9Contract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(guy: string, wad: BigNumber): string {
assert.isString('guy', guy);
assert.isBigNumber('wad', wad);
@@ -221,8 +273,27 @@ export class WETH9Contract extends BaseContract {
]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): boolean {
const self = (this as any) as WETH9Contract;
const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<boolean>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): boolean {
const self = (this as any) as WETH9Contract;
const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<boolean>(returnData);
return abiDecodedReturnData;
},
};
public totalSupply = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
*/
async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<BigNumber> {
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
schemas.addressSchema,
@@ -254,13 +325,38 @@ export class WETH9Contract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(): string {
const self = (this as any) as WETH9Contract;
const abiEncodedTransactionData = self._strictEncodeArguments('totalSupply()', []);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): BigNumber {
const self = (this as any) as WETH9Contract;
const abiEncoder = self._lookupAbiEncoder('totalSupply()');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<BigNumber>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): BigNumber {
const self = (this as any) as WETH9Contract;
const abiEncoder = self._lookupAbiEncoder('totalSupply()');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<BigNumber>(returnData);
return abiDecodedReturnData;
},
};
public transferFrom = {
/**
* Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write
* Ethereum operation and will cost gas.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async sendTransactionAsync(
src: string,
dst: string,
@@ -292,6 +388,13 @@ export class WETH9Contract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
/**
* Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting.
* If the transaction was mined, but reverted, an error is thrown.
* @param txData Additional data for transaction
* @param pollingIntervalMs Interval at which to poll for success
* @returns A promise that resolves when the transaction is successful
*/
awaitTransactionSuccessAsync(
src: string,
dst: string,
@@ -322,6 +425,11 @@ export class WETH9Contract extends BaseContract {
})(),
);
},
/**
* Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async estimateGasAsync(
src: string,
dst: string,
@@ -352,6 +460,11 @@ export class WETH9Contract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
*/
async callAsync(
src: string,
dst: string,
@@ -396,6 +509,11 @@ export class WETH9Contract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(src: string, dst: string, wad: BigNumber): string {
assert.isString('src', src);
assert.isString('dst', dst);
@@ -408,8 +526,28 @@ export class WETH9Contract extends BaseContract {
]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): boolean {
const self = (this as any) as WETH9Contract;
const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<boolean>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): boolean {
const self = (this as any) as WETH9Contract;
const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<boolean>(returnData);
return abiDecodedReturnData;
},
};
public withdraw = {
/**
* Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write
* Ethereum operation and will cost gas.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async sendTransactionAsync(wad: BigNumber, txData?: Partial<TxData> | undefined): Promise<string> {
assert.isBigNumber('wad', wad);
const self = (this as any) as WETH9Contract;
@@ -430,6 +568,13 @@ export class WETH9Contract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
/**
* Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting.
* If the transaction was mined, but reverted, an error is thrown.
* @param txData Additional data for transaction
* @param pollingIntervalMs Interval at which to poll for success
* @returns A promise that resolves when the transaction is successful
*/
awaitTransactionSuccessAsync(
wad: BigNumber,
txData?: Partial<TxData>,
@@ -451,6 +596,11 @@ export class WETH9Contract extends BaseContract {
})(),
);
},
/**
* Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async estimateGasAsync(wad: BigNumber, txData?: Partial<TxData> | undefined): Promise<number> {
assert.isBigNumber('wad', wad);
const self = (this as any) as WETH9Contract;
@@ -470,6 +620,11 @@ export class WETH9Contract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
*/
async callAsync(wad: BigNumber, callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<void> {
assert.isBigNumber('wad', wad);
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
@@ -502,14 +657,38 @@ export class WETH9Contract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(wad: BigNumber): string {
assert.isBigNumber('wad', wad);
const self = (this as any) as WETH9Contract;
const abiEncodedTransactionData = self._strictEncodeArguments('withdraw(uint256)', [wad]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): void {
const self = (this as any) as WETH9Contract;
const abiEncoder = self._lookupAbiEncoder('withdraw(uint256)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<void>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): void {
const self = (this as any) as WETH9Contract;
const abiEncoder = self._lookupAbiEncoder('withdraw(uint256)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
};
public decimals = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
*/
async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<number> {
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
schemas.addressSchema,
@@ -541,13 +720,37 @@ export class WETH9Contract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(): string {
const self = (this as any) as WETH9Contract;
const abiEncodedTransactionData = self._strictEncodeArguments('decimals()', []);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): number {
const self = (this as any) as WETH9Contract;
const abiEncoder = self._lookupAbiEncoder('decimals()');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<number>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): number {
const self = (this as any) as WETH9Contract;
const abiEncoder = self._lookupAbiEncoder('decimals()');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<number>(returnData);
return abiDecodedReturnData;
},
};
public balanceOf = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
*/
async callAsync(
index_0: string,
callData: Partial<CallData> = {},
@@ -584,6 +787,11 @@ export class WETH9Contract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(index_0: string): string {
assert.isString('index_0', index_0);
const self = (this as any) as WETH9Contract;
@@ -592,8 +800,27 @@ export class WETH9Contract extends BaseContract {
]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): BigNumber {
const self = (this as any) as WETH9Contract;
const abiEncoder = self._lookupAbiEncoder('balanceOf(address)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<BigNumber>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): BigNumber {
const self = (this as any) as WETH9Contract;
const abiEncoder = self._lookupAbiEncoder('balanceOf(address)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<BigNumber>(returnData);
return abiDecodedReturnData;
},
};
public symbol = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
*/
async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<string> {
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
schemas.addressSchema,
@@ -625,13 +852,38 @@ export class WETH9Contract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(): string {
const self = (this as any) as WETH9Contract;
const abiEncodedTransactionData = self._strictEncodeArguments('symbol()', []);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): string {
const self = (this as any) as WETH9Contract;
const abiEncoder = self._lookupAbiEncoder('symbol()');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<string>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): string {
const self = (this as any) as WETH9Contract;
const abiEncoder = self._lookupAbiEncoder('symbol()');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<string>(returnData);
return abiDecodedReturnData;
},
};
public transfer = {
/**
* Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write
* Ethereum operation and will cost gas.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async sendTransactionAsync(dst: string, wad: BigNumber, txData?: Partial<TxData> | undefined): Promise<string> {
assert.isString('dst', dst);
assert.isBigNumber('wad', wad);
@@ -653,6 +905,13 @@ export class WETH9Contract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
/**
* Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting.
* If the transaction was mined, but reverted, an error is thrown.
* @param txData Additional data for transaction
* @param pollingIntervalMs Interval at which to poll for success
* @returns A promise that resolves when the transaction is successful
*/
awaitTransactionSuccessAsync(
dst: string,
wad: BigNumber,
@@ -676,6 +935,11 @@ export class WETH9Contract extends BaseContract {
})(),
);
},
/**
* Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async estimateGasAsync(dst: string, wad: BigNumber, txData?: Partial<TxData> | undefined): Promise<number> {
assert.isString('dst', dst);
assert.isBigNumber('wad', wad);
@@ -696,6 +960,11 @@ export class WETH9Contract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
*/
async callAsync(
dst: string,
wad: BigNumber,
@@ -734,6 +1003,11 @@ export class WETH9Contract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(dst: string, wad: BigNumber): string {
assert.isString('dst', dst);
assert.isBigNumber('wad', wad);
@@ -744,8 +1018,28 @@ export class WETH9Contract extends BaseContract {
]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): boolean {
const self = (this as any) as WETH9Contract;
const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<boolean>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): boolean {
const self = (this as any) as WETH9Contract;
const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<boolean>(returnData);
return abiDecodedReturnData;
},
};
public deposit = {
/**
* Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write
* Ethereum operation and will cost gas.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async sendTransactionAsync(txData?: Partial<TxData> | undefined): Promise<string> {
const self = (this as any) as WETH9Contract;
const encodedData = self._strictEncodeArguments('deposit()', []);
@@ -765,6 +1059,13 @@ export class WETH9Contract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
/**
* Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting.
* If the transaction was mined, but reverted, an error is thrown.
* @param txData Additional data for transaction
* @param pollingIntervalMs Interval at which to poll for success
* @returns A promise that resolves when the transaction is successful
*/
awaitTransactionSuccessAsync(
txData?: Partial<TxData>,
pollingIntervalMs?: number,
@@ -784,6 +1085,11 @@ export class WETH9Contract extends BaseContract {
})(),
);
},
/**
* Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async estimateGasAsync(txData?: Partial<TxData> | undefined): Promise<number> {
const self = (this as any) as WETH9Contract;
const encodedData = self._strictEncodeArguments('deposit()', []);
@@ -802,6 +1108,11 @@ export class WETH9Contract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
*/
async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<void> {
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
schemas.addressSchema,
@@ -833,13 +1144,37 @@ export class WETH9Contract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(): string {
const self = (this as any) as WETH9Contract;
const abiEncodedTransactionData = self._strictEncodeArguments('deposit()', []);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): void {
const self = (this as any) as WETH9Contract;
const abiEncoder = self._lookupAbiEncoder('deposit()');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<void>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): void {
const self = (this as any) as WETH9Contract;
const abiEncoder = self._lookupAbiEncoder('deposit()');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
};
public allowance = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
*/
async callAsync(
index_0: string,
index_1: string,
@@ -881,6 +1216,11 @@ export class WETH9Contract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(index_0: string, index_1: string): string {
assert.isString('index_0', index_0);
assert.isString('index_1', index_1);
@@ -891,6 +1231,20 @@ export class WETH9Contract extends BaseContract {
]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): BigNumber {
const self = (this as any) as WETH9Contract;
const abiEncoder = self._lookupAbiEncoder('allowance(address,address)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<BigNumber>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): BigNumber {
const self = (this as any) as WETH9Contract;
const abiEncoder = self._lookupAbiEncoder('allowance(address,address)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<BigNumber>(returnData);
return abiDecodedReturnData;
},
};
private readonly _subscriptionManager: SubscriptionManager<WETH9EventArgs, WETH9Events>;
public static async deployFrom0xArtifactAsync(
@@ -911,8 +1265,10 @@ export class WETH9Contract extends BaseContract {
const bytecode = artifact.compilerOutput.evm.bytecode.object;
const abi = artifact.compilerOutput.abi;
const logDecodeDependenciesAbiOnly: { [contractName: string]: ContractAbi } = {};
for (const key of Object.keys(logDecodeDependencies)) {
logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi;
if (Object.keys(logDecodeDependencies) !== undefined) {
for (const key of Object.keys(logDecodeDependencies)) {
logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi;
}
}
return WETH9Contract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly);
}
@@ -1248,11 +1604,11 @@ export class WETH9Contract extends BaseContract {
}
/**
* Subscribe to an event type emitted by the WETH9 contract.
* @param eventName The WETH9 contract event you would like to subscribe to.
* @param indexFilterValues An object where the keys are indexed args returned by the event and
* the value is the value you are interested in. E.g `{maker: aUserAddressHex}`
* @param callback Callback that gets called when a log is added/removed
* @param isVerbose Enable verbose subscription warnings (e.g recoverable network issues encountered)
* @param eventName The WETH9 contract event you would like to subscribe to.
* @param indexFilterValues An object where the keys are indexed args returned by the event and
* the value is the value you are interested in. E.g `{maker: aUserAddressHex}`
* @param callback Callback that gets called when a log is added/removed
* @param isVerbose Enable verbose subscription warnings (e.g recoverable network issues encountered)
* @return Subscription token used later to unsubscribe
*/
public subscribe<ArgsType extends WETH9EventArgs>(
@@ -1278,7 +1634,7 @@ export class WETH9Contract extends BaseContract {
}
/**
* Cancel a subscription
* @param subscriptionToken Subscription token returned by `subscribe()`
* @param subscriptionToken Subscription token returned by `subscribe()`
*/
public unsubscribe(subscriptionToken: string): void {
this._subscriptionManager.unsubscribe(subscriptionToken);
@@ -1291,11 +1647,11 @@ export class WETH9Contract extends BaseContract {
}
/**
* Gets historical logs without creating a subscription
* @param eventName The WETH9 contract event you would like to subscribe to.
* @param blockRange Block range to get logs from.
* @param indexFilterValues An object where the keys are indexed args returned by the event and
* the value is the value you are interested in. E.g `{_from: aUserAddressHex}`
* @return Array of logs that match the parameters
* @param eventName The WETH9 contract event you would like to subscribe to.
* @param blockRange Block range to get logs from.
* @param indexFilterValues An object where the keys are indexed args returned by the event and
* the value is the value you are interested in. E.g `{_from: aUserAddressHex}`
* @return Array of logs that match the parameters
*/
public async getLogsAsync<ArgsType extends WETH9EventArgs>(
eventName: WETH9Events,

View File

@@ -55,6 +55,11 @@ export interface ZRXTokenApprovalEventArgs extends DecodedLogArgs {
// tslint:disable-next-line:class-name
export class ZRXTokenContract extends BaseContract {
public name = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
*/
async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<string> {
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
schemas.addressSchema,
@@ -86,13 +91,38 @@ export class ZRXTokenContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(): string {
const self = (this as any) as ZRXTokenContract;
const abiEncodedTransactionData = self._strictEncodeArguments('name()', []);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): string {
const self = (this as any) as ZRXTokenContract;
const abiEncoder = self._lookupAbiEncoder('name()');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<string>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): string {
const self = (this as any) as ZRXTokenContract;
const abiEncoder = self._lookupAbiEncoder('name()');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<string>(returnData);
return abiDecodedReturnData;
},
};
public approve = {
/**
* Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write
* Ethereum operation and will cost gas.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async sendTransactionAsync(
_spender: string,
_value: BigNumber,
@@ -121,6 +151,13 @@ export class ZRXTokenContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
/**
* Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting.
* If the transaction was mined, but reverted, an error is thrown.
* @param txData Additional data for transaction
* @param pollingIntervalMs Interval at which to poll for success
* @returns A promise that resolves when the transaction is successful
*/
awaitTransactionSuccessAsync(
_spender: string,
_value: BigNumber,
@@ -144,6 +181,11 @@ export class ZRXTokenContract extends BaseContract {
})(),
);
},
/**
* Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async estimateGasAsync(
_spender: string,
_value: BigNumber,
@@ -171,6 +213,11 @@ export class ZRXTokenContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
*/
async callAsync(
_spender: string,
_value: BigNumber,
@@ -212,6 +259,11 @@ export class ZRXTokenContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(_spender: string, _value: BigNumber): string {
assert.isString('_spender', _spender);
assert.isBigNumber('_value', _value);
@@ -222,8 +274,27 @@ export class ZRXTokenContract extends BaseContract {
]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): boolean {
const self = (this as any) as ZRXTokenContract;
const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<boolean>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): boolean {
const self = (this as any) as ZRXTokenContract;
const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<boolean>(returnData);
return abiDecodedReturnData;
},
};
public totalSupply = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
*/
async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<BigNumber> {
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
schemas.addressSchema,
@@ -255,13 +326,44 @@ export class ZRXTokenContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(): string {
const self = (this as any) as ZRXTokenContract;
const abiEncodedTransactionData = self._strictEncodeArguments('totalSupply()', []);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): BigNumber {
const self = (this as any) as ZRXTokenContract;
const abiEncoder = self._lookupAbiEncoder('totalSupply()');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<BigNumber>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): BigNumber {
const self = (this as any) as ZRXTokenContract;
const abiEncoder = self._lookupAbiEncoder('totalSupply()');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<BigNumber>(returnData);
return abiDecodedReturnData;
},
};
/**
* ERC20 transferFrom, modified such that an allowance of MAX_UINT represents an unlimited allowance.
*/
public transferFrom = {
/**
* Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write
* Ethereum operation and will cost gas.
* @param _from Address to transfer from.
* @param _to Address to transfer to.
* @param _value Amount to transfer.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async sendTransactionAsync(
_from: string,
_to: string,
@@ -293,6 +395,16 @@ export class ZRXTokenContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
/**
* Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting.
* If the transaction was mined, but reverted, an error is thrown.
* @param _from Address to transfer from.
* @param _to Address to transfer to.
* @param _value Amount to transfer.
* @param txData Additional data for transaction
* @param pollingIntervalMs Interval at which to poll for success
* @returns A promise that resolves when the transaction is successful
*/
awaitTransactionSuccessAsync(
_from: string,
_to: string,
@@ -323,6 +435,14 @@ export class ZRXTokenContract extends BaseContract {
})(),
);
},
/**
* Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments.
* @param _from Address to transfer from.
* @param _to Address to transfer to.
* @param _value Amount to transfer.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async estimateGasAsync(
_from: string,
_to: string,
@@ -353,6 +473,15 @@ export class ZRXTokenContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
* @param _from Address to transfer from.
* @param _to Address to transfer to.
* @param _value Amount to transfer.
* @returns Success of transfer.
*/
async callAsync(
_from: string,
_to: string,
@@ -397,6 +526,14 @@ export class ZRXTokenContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
* @param _from Address to transfer from.
* @param _to Address to transfer to.
* @param _value Amount to transfer.
*/
getABIEncodedTransactionData(_from: string, _to: string, _value: BigNumber): string {
assert.isString('_from', _from);
assert.isString('_to', _to);
@@ -409,8 +546,27 @@ export class ZRXTokenContract extends BaseContract {
]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): boolean {
const self = (this as any) as ZRXTokenContract;
const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<boolean>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): boolean {
const self = (this as any) as ZRXTokenContract;
const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<boolean>(returnData);
return abiDecodedReturnData;
},
};
public decimals = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
*/
async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<number> {
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
schemas.addressSchema,
@@ -442,13 +598,37 @@ export class ZRXTokenContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(): string {
const self = (this as any) as ZRXTokenContract;
const abiEncodedTransactionData = self._strictEncodeArguments('decimals()', []);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): number {
const self = (this as any) as ZRXTokenContract;
const abiEncoder = self._lookupAbiEncoder('decimals()');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<number>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): number {
const self = (this as any) as ZRXTokenContract;
const abiEncoder = self._lookupAbiEncoder('decimals()');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<number>(returnData);
return abiDecodedReturnData;
},
};
public balanceOf = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
*/
async callAsync(
_owner: string,
callData: Partial<CallData> = {},
@@ -485,14 +665,38 @@ export class ZRXTokenContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(_owner: string): string {
assert.isString('_owner', _owner);
const self = (this as any) as ZRXTokenContract;
const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): BigNumber {
const self = (this as any) as ZRXTokenContract;
const abiEncoder = self._lookupAbiEncoder('balanceOf(address)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<BigNumber>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): BigNumber {
const self = (this as any) as ZRXTokenContract;
const abiEncoder = self._lookupAbiEncoder('balanceOf(address)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<BigNumber>(returnData);
return abiDecodedReturnData;
},
};
public symbol = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
*/
async callAsync(callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<string> {
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
schemas.addressSchema,
@@ -524,13 +728,38 @@ export class ZRXTokenContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(): string {
const self = (this as any) as ZRXTokenContract;
const abiEncodedTransactionData = self._strictEncodeArguments('symbol()', []);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): string {
const self = (this as any) as ZRXTokenContract;
const abiEncoder = self._lookupAbiEncoder('symbol()');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<string>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): string {
const self = (this as any) as ZRXTokenContract;
const abiEncoder = self._lookupAbiEncoder('symbol()');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<string>(returnData);
return abiDecodedReturnData;
},
};
public transfer = {
/**
* Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write
* Ethereum operation and will cost gas.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async sendTransactionAsync(
_to: string,
_value: BigNumber,
@@ -556,6 +785,13 @@ export class ZRXTokenContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
/**
* Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting.
* If the transaction was mined, but reverted, an error is thrown.
* @param txData Additional data for transaction
* @param pollingIntervalMs Interval at which to poll for success
* @returns A promise that resolves when the transaction is successful
*/
awaitTransactionSuccessAsync(
_to: string,
_value: BigNumber,
@@ -579,6 +815,11 @@ export class ZRXTokenContract extends BaseContract {
})(),
);
},
/**
* Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments.
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async estimateGasAsync(_to: string, _value: BigNumber, txData?: Partial<TxData> | undefined): Promise<number> {
assert.isString('_to', _to);
assert.isBigNumber('_value', _value);
@@ -599,6 +840,11 @@ export class ZRXTokenContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
*/
async callAsync(
_to: string,
_value: BigNumber,
@@ -637,6 +883,11 @@ export class ZRXTokenContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(_to: string, _value: BigNumber): string {
assert.isString('_to', _to);
assert.isBigNumber('_value', _value);
@@ -647,8 +898,27 @@ export class ZRXTokenContract extends BaseContract {
]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): boolean {
const self = (this as any) as ZRXTokenContract;
const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<boolean>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): boolean {
const self = (this as any) as ZRXTokenContract;
const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<boolean>(returnData);
return abiDecodedReturnData;
},
};
public allowance = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
*/
async callAsync(
_owner: string,
_spender: string,
@@ -690,6 +960,11 @@ export class ZRXTokenContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(_owner: string, _spender: string): string {
assert.isString('_owner', _owner);
assert.isString('_spender', _spender);
@@ -700,6 +975,20 @@ export class ZRXTokenContract extends BaseContract {
]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): BigNumber {
const self = (this as any) as ZRXTokenContract;
const abiEncoder = self._lookupAbiEncoder('allowance(address,address)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<BigNumber>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): BigNumber {
const self = (this as any) as ZRXTokenContract;
const abiEncoder = self._lookupAbiEncoder('allowance(address,address)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<BigNumber>(returnData);
return abiDecodedReturnData;
},
};
private readonly _subscriptionManager: SubscriptionManager<ZRXTokenEventArgs, ZRXTokenEvents>;
public static async deployFrom0xArtifactAsync(
@@ -720,8 +1009,10 @@ export class ZRXTokenContract extends BaseContract {
const bytecode = artifact.compilerOutput.evm.bytecode.object;
const abi = artifact.compilerOutput.abi;
const logDecodeDependenciesAbiOnly: { [contractName: string]: ContractAbi } = {};
for (const key of Object.keys(logDecodeDependencies)) {
logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi;
if (Object.keys(logDecodeDependencies) !== undefined) {
for (const key of Object.keys(logDecodeDependencies)) {
logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi;
}
}
return ZRXTokenContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly);
}
@@ -988,11 +1279,11 @@ export class ZRXTokenContract extends BaseContract {
}
/**
* Subscribe to an event type emitted by the ZRXToken contract.
* @param eventName The ZRXToken contract event you would like to subscribe to.
* @param indexFilterValues An object where the keys are indexed args returned by the event and
* the value is the value you are interested in. E.g `{maker: aUserAddressHex}`
* @param callback Callback that gets called when a log is added/removed
* @param isVerbose Enable verbose subscription warnings (e.g recoverable network issues encountered)
* @param eventName The ZRXToken contract event you would like to subscribe to.
* @param indexFilterValues An object where the keys are indexed args returned by the event and
* the value is the value you are interested in. E.g `{maker: aUserAddressHex}`
* @param callback Callback that gets called when a log is added/removed
* @param isVerbose Enable verbose subscription warnings (e.g recoverable network issues encountered)
* @return Subscription token used later to unsubscribe
*/
public subscribe<ArgsType extends ZRXTokenEventArgs>(
@@ -1018,7 +1309,7 @@ export class ZRXTokenContract extends BaseContract {
}
/**
* Cancel a subscription
* @param subscriptionToken Subscription token returned by `subscribe()`
* @param subscriptionToken Subscription token returned by `subscribe()`
*/
public unsubscribe(subscriptionToken: string): void {
this._subscriptionManager.unsubscribe(subscriptionToken);
@@ -1031,11 +1322,11 @@ export class ZRXTokenContract extends BaseContract {
}
/**
* Gets historical logs without creating a subscription
* @param eventName The ZRXToken contract event you would like to subscribe to.
* @param blockRange Block range to get logs from.
* @param indexFilterValues An object where the keys are indexed args returned by the event and
* the value is the value you are interested in. E.g `{_from: aUserAddressHex}`
* @return Array of logs that match the parameters
* @param eventName The ZRXToken contract event you would like to subscribe to.
* @param blockRange Block range to get logs from.
* @param indexFilterValues An object where the keys are indexed args returned by the event and
* the value is the value you are interested in. E.g `{_from: aUserAddressHex}`
* @return Array of logs that match the parameters
*/
public async getLogsAsync<ArgsType extends ZRXTokenEventArgs>(
eventName: ZRXTokenEvents,

View File

@@ -2,6 +2,7 @@ export * from './generated-wrappers/asset_proxy_owner';
export * from './generated-wrappers/dummy_erc20_token';
export * from './generated-wrappers/dummy_erc721_token';
export * from './generated-wrappers/dutch_auction';
export * from './generated-wrappers/erc1155_proxy';
export * from './generated-wrappers/erc20_proxy';
export * from './generated-wrappers/erc20_token';
export * from './generated-wrappers/erc721_proxy';
@@ -13,6 +14,7 @@ export * from './generated-wrappers/i_validator';
export * from './generated-wrappers/i_wallet';
export * from './generated-wrappers/multi_asset_proxy';
export * from './generated-wrappers/order_validator';
export * from './generated-wrappers/static_call_proxy';
export * from './generated-wrappers/weth9';
export * from './generated-wrappers/zrx_token';
export * from './generated-wrappers/coordinator';

View File

@@ -0,0 +1,7 @@
{
"extends": "../../typedoc-tsconfig",
"compilerOptions": {
"outDir": "lib"
},
"include": ["./src/**/*"]
}

View File

@@ -1,12 +1,67 @@
[
{
"timestamp": 1564604963,
"version": "4.1.0",
"changes": [
{
"note": "Updated expected typescript output for cli tests to include `getABIDecodedTransactionData` and `getABIDecodedReturnData`",
"pr": 2018
},
{
"note": "Added tests for`getABIDecodedTransactionData` and `getABIDecodedReturnData` in contract wrappers.",
"pr": 2018
}
],
"timestamp": 1565296576
},
{
"version": "4.0.0",
"changes": [
{
"note": "whitespace changes to generated Python code",
"pr": 1996
},
{
"note": "move Python Validator base class from generated code to common package",
"pr": 1996
},
{
"note": "Changed fundamental thing-to-be-wrapped from the contract to the contract method. That is, now there is a base contract method wrapper class rather than a base contract wrapper class, and individual contract methods are represented by named classes inheriting from that base, and the different operations on a method are now represented by a nested-object dot notation, ie, WrappedContract.ContractMethod.call() and WrappedContract.ContractMethod.send_transaction().",
"pr": 1996
},
{
"note": "added gas estimation functionality to contract methods",
"pr": 1996
},
{
"note": "Python: fixed bug with methods returning multiple values",
"pr": 1996
},
{
"note": "Python: fixed bug with methods returning arrays of structs",
"pr": 1996
},
{
"note": "Python: fixed bug with methods that return a struct that contains another struct where the inner struct was not otherwise directly referenced by any method",
"pr": 1996
},
{
"note": "Python: fixed bug with tuples sometimes being used before they were declared",
"pr": 1996
},
{
"note": "Python: fixed bug with supporting overloaded methods",
"pr": 1996
}
]
},
{
"version": "3.1.2",
"changes": [
{
"note": "Dependencies updated"
}
]
],
"timestamp": 1564604963
},
{
"version": "3.1.1",

View File

@@ -5,6 +5,23 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v4.1.0 - _August 8, 2019_
* Updated expected typescript output for cli tests to include `getABIDecodedTransactionData` and `getABIDecodedReturnData` (#2018)
* Added tests for`getABIDecodedTransactionData` and `getABIDecodedReturnData` in contract wrappers. (#2018)
## v4.0.0 - _Invalid date_
* whitespace changes to generated Python code (#1996)
* move Python Validator base class from generated code to common package (#1996)
* Changed fundamental thing-to-be-wrapped from the contract to the contract method. That is, now there is a base contract method wrapper class rather than a base contract wrapper class, and individual contract methods are represented by named classes inheriting from that base, and the different operations on a method are now represented by a nested-object dot notation, ie, WrappedContract.ContractMethod.call() and WrappedContract.ContractMethod.send_transaction(). (#1996)
* added gas estimation functionality to contract methods (#1996)
* Python: fixed bug with methods returning multiple values (#1996)
* Python: fixed bug with methods returning arrays of structs (#1996)
* Python: fixed bug with methods that return a struct that contains another struct where the inner struct was not otherwise directly referenced by any method (#1996)
* Python: fixed bug with tuples sometimes being used before they were declared (#1996)
* Python: fixed bug with supporting overloaded methods (#1996)
## v3.1.2 - _July 31, 2019_
* Dependencies updated

View File

@@ -110,7 +110,7 @@ The files in `test-cli/` are used to test the CLI output against a set of dummy
Compile dummy contracts and generate wrappers:
```
yarn test_cli:prebuild
yarn compile:sol
```
Build generated wrappers and unit tests:

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/abi-gen",
"version": "3.1.2",
"version": "4.1.0",
"engines": {
"node": ">=6.12"
},
@@ -23,6 +23,7 @@
"test_cli:clean": "rm -rf test-cli/output && rm -rf test-cli/test_typescript/lib",
"test_cli:build": "tsc --project test-cli/tsconfig.json",
"test_cli:run_mocha": "mocha --require source-map-support/register --require make-promises-safe test-cli/test_typescript/lib/**/*_test.js --timeout 100000 --bail --exit",
"test_cli:test_python": "black --check test-cli/output/python/**/__init__.py; test $? -le 1 # just make sure black can parse the output",
"rebuild_and_test": "run-s build test",
"test:profiler": "SOLIDITY_PROFILER=true run-s build run_mocha profiler:report:html",
"test:trace": "SOLIDITY_REVERT_TRACE=true run-s build run_mocha",
@@ -58,7 +59,8 @@
"dependencies": {
"@0x/types": "^2.4.1",
"@0x/typescript-typings": "^4.2.4",
"@0x/utils": "^4.4.2",
"@0x/utils": "^4.5.0",
"@types/toposort": "^2.0.1",
"chalk": "^2.3.0",
"change-case": "^3.0.2",
"cli-format": "^3.0.9",
@@ -69,16 +71,17 @@
"mkdirp": "^0.5.1",
"tmp": "^0.0.33",
"to-snake-case": "^1.0.0",
"toposort": "^2.0.2",
"yargs": "^10.0.3"
},
"devDependencies": {
"@0x/base-contract": "^5.3.0",
"@0x/contracts-gen": "^1.0.12",
"@0x/dev-utils": "^2.2.6",
"@0x/sol-compiler": "^3.1.11",
"@0x/subproviders": "^5.0.0",
"@0x/base-contract": "^5.3.1",
"@0x/contracts-gen": "^1.0.13",
"@0x/dev-utils": "^2.3.0",
"@0x/sol-compiler": "^3.1.12",
"@0x/subproviders": "^5.0.1",
"@0x/tslint-config": "^3.0.1",
"@0x/web3-wrapper": "^6.0.9",
"@0x/web3-wrapper": "^6.0.10",
"@types/glob": "5.0.35",
"@types/mkdirp": "^0.5.2",
"@types/mocha": "^5.2.7",

View File

@@ -12,12 +12,12 @@ import {
DevdocOutput,
EventAbi,
MethodAbi,
TupleDataItem,
} from 'ethereum-types';
import { sync as globSync } from 'glob';
import * as Handlebars from 'handlebars';
import * as _ from 'lodash';
import * as mkdirp from 'mkdirp';
import toposort = require('toposort');
import * as yargs from 'yargs';
import { ContextData, ContractsBackend, ParamKind } from './types';
@@ -104,6 +104,43 @@ function registerTypeScriptHelpers(): void {
return context !== undefined;
},
);
// Format docstring for method description
Handlebars.registerHelper(
'formatDocstringForMethodTs',
(docString: string): Handlebars.SafeString => {
// preserve newlines
const regex = /([ ]{4,})+/gi;
const formatted = docString.replace(regex, '\n * ');
return new Handlebars.SafeString(formatted);
},
);
// Get docstring for method param
Handlebars.registerHelper(
'getDocstringForParamTs',
(paramName: string, devdocParamsObj: { [name: string]: string }): Handlebars.SafeString | undefined => {
if (devdocParamsObj === undefined || devdocParamsObj[paramName] === undefined) {
return undefined;
}
return new Handlebars.SafeString(`${devdocParamsObj[paramName]}`);
},
);
// Format docstring for method param
Handlebars.registerHelper(
'formatDocstringForParamTs',
(paramName: string, desc: Handlebars.SafeString): Handlebars.SafeString => {
const docString = `@param ${paramName} ${desc}`;
const hangingIndentLength = 4;
const config = {
width: 80,
paddingLeft: ' * ',
hangingIndent: ' '.repeat(hangingIndentLength),
ansi: false,
};
return new Handlebars.SafeString(`${cliFormat.wrap(docString, config)}`);
},
);
}
function registerPythonHelpers(): void {
@@ -116,13 +153,18 @@ function registerPythonHelpers(): void {
Handlebars.registerHelper('toPythonIdentifier', utils.toPythonIdentifier.bind(utils));
Handlebars.registerHelper('sanitizeDevdocDetails', (_methodName: string, devdocDetails: string, indent: number) => {
// wrap to 80 columns, assuming given indent, so that generated
// docstrings can pass pycodestyle checks.
// docstrings can pass pycodestyle checks. also, replace repeated
// spaces, likely caused by leading indents in the Solidity, because
// they cause repeated spaces in the output, and in particular they may
// cause repeated spaces at the beginning of a line in the docstring,
// which leads to "unexpected indent" errors when generating
// documentation.
if (devdocDetails === undefined || devdocDetails.length === 0) {
return '';
}
const columnsPerRow = 80;
return new Handlebars.SafeString(
`\n${cliFormat.wrap(devdocDetails || '', {
`\n${cliFormat.wrap(devdocDetails.replace(/ +/g, ' ') || '', {
paddingLeft: ' '.repeat(indent),
width: columnsPerRow,
ansi: false,
@@ -154,10 +196,15 @@ function registerPythonHelpers(): void {
Handlebars.registerHelper('tupleDefinitions', (abisJSON: string) => {
const abis: AbiDefinition[] = JSON.parse(abisJSON);
// build an array of objects, each of which has one key, the Python
// name of a tuple, with a string value holding the Python
// definition of that tuple. Using a key-value object conveniently
// name of a tuple, with a string value holding the body of a Python
// class representing that tuple. Using a key-value object conveniently
// filters duplicate references to the same tuple.
const tupleDefinitions: { [pythonTupleName: string]: string } = {};
const tupleBodies: { [pythonTupleName: string]: string } = {};
// build an array of tuple dependencies, whose format conforms to the
// expected input to toposort, a function to do a topological sort,
// which will help us declare tuples in the proper order, avoiding
// references to tuples that haven't been declared yet.
const tupleDependencies: Array<[string, string]> = [];
for (const abi of abis) {
let parameters: DataItem[] = [];
if (abi.hasOwnProperty('inputs')) {
@@ -179,24 +226,36 @@ function registerPythonHelpers(): void {
parameters = parameters.concat((abi as MethodAbi).outputs);
}
for (const parameter of parameters) {
if (parameter.type === 'tuple') {
tupleDefinitions[
utils.makePythonTupleName((parameter as TupleDataItem).components)
] = utils.makePythonTupleClassBody((parameter as TupleDataItem).components);
}
utils.extractTuples(parameter, tupleBodies, tupleDependencies);
}
}
// build up a list of tuples to declare. the order they're pushed into
// this array is the order they will be declared.
const tuplesToDeclare = [];
// first push the ones that have dependencies
tuplesToDeclare.push(...toposort(tupleDependencies));
// then push any remaining bodies (the ones that DON'T have
// dependencies)
for (const pythonTupleName in tupleBodies) {
if (!tuplesToDeclare.includes(pythonTupleName)) {
tuplesToDeclare.push(pythonTupleName);
}
}
// now iterate over those ordered tuples-to-declare, and prefix the
// corresponding class bodies with their class headers, to form full
// class declarations.
const tupleDeclarations = [];
for (const pythonTupleName in tupleDefinitions) {
if (tupleDefinitions[pythonTupleName]) {
for (const pythonTupleName of tuplesToDeclare) {
if (tupleBodies[pythonTupleName]) {
tupleDeclarations.push(
`class ${pythonTupleName}(TypedDict):\n """Python representation of a tuple or struct.\n\n A tuple found in an ABI may have been written in Solidity as a literal\n tuple, or it may have been written as a parameter with a Solidity\n \`struct\`:code: data type; there's no way to tell which, based solely on the\n ABI, and the name of a Solidity \`struct\`:code: is not conveyed through the\n ABI. This class represents a tuple that appeared in a method definition.\n Its name is derived from a hash of that tuple's field names, and every\n method whose ABI refers to a tuple with that same list of field names will\n have a generated wrapper method that refers to this class.\n\n Any members of type \`bytes\`:code: should be encoded as UTF-8, which can be\n accomplished via \`str.encode("utf_8")\`:code:\n """${
tupleDefinitions[pythonTupleName]
`class ${pythonTupleName}(TypedDict):\n """Python representation of a tuple or struct.\n\n Solidity compiler output does not include the names of structs that appear\n in method definitions. A tuple found in an ABI may have been written in\n Solidity as a literal, anonymous tuple, or it may have been written as a\n named \`struct\`:code:, but there is no way to tell from the compiler\n output. This class represents a tuple that appeared in a method\n definition. Its name is derived from a hash of that tuple's field names,\n and every method whose ABI refers to a tuple with that same list of field\n names will have a generated wrapper method that refers to this class.\n\n Any members of type \`bytes\`:code: should be encoded as UTF-8, which can be\n accomplished via \`str.encode("utf_8")\`:code:\n """${
tupleBodies[pythonTupleName]
}`,
);
}
}
return new Handlebars.SafeString(tupleDeclarations.join('\n\n'));
// finally, join the class declarations together for the output file
return new Handlebars.SafeString(tupleDeclarations.join('\n\n\n'));
});
Handlebars.registerHelper('docBytesIfNecessary', (abisJSON: string) => {
const abis: AbiDefinition[] = JSON.parse(abisJSON);
@@ -225,6 +284,10 @@ function registerPythonHelpers(): void {
}
return '';
});
Handlebars.registerHelper(
'toPythonClassname',
(sourceName: string) => new Handlebars.SafeString(changeCase.pascal(sourceName)),
);
}
if (args.language === 'TypeScript') {
registerTypeScriptHelpers();

View File

@@ -2,7 +2,7 @@ import { createHash } from 'crypto';
import * as changeCase from 'change-case';
import * as cliFormat from 'cli-format';
import { AbiType, ConstructorAbi, DataItem } from 'ethereum-types';
import { AbiType, ConstructorAbi, DataItem, TupleDataItem } from 'ethereum-types';
import * as fs from 'fs';
import * as _ from 'lodash';
import * as path from 'path';
@@ -350,4 +350,28 @@ export const utils = {
hangingIndent: ' '.repeat(columnsPerIndent),
});
},
extractTuples(
parameter: DataItem,
tupleBodies: { [pythonTupleName: string]: string }, // output
tupleDependencies: Array<[string, string]>, // output
): void {
if (parameter.type === 'tuple' || parameter.type === 'tuple[]') {
const tupleDataItem = parameter as TupleDataItem; // tslint:disable-line:no-unnecessary-type-assertion
// without the above cast (which tslint complains about), tsc says
// Argument of type 'DataItem[] | undefined' is not assignable to parameter of type 'DataItem[]'.
// Type 'undefined' is not assignable to type 'DataItem[]'
// when the code below tries to access tupleDataItem.components.
const pythonTupleName = utils.makePythonTupleName(tupleDataItem.components);
tupleBodies[pythonTupleName] = utils.makePythonTupleClassBody(tupleDataItem.components);
for (const component of tupleDataItem.components) {
if (component.type === 'tuple' || component.type === 'tuple[]') {
tupleDependencies.push([
utils.makePythonTupleName((component as TupleDataItem).components), // tslint:disable-line:no-unnecessary-type-assertion
pythonTupleName,
]);
utils.extractTuples(component, tupleBodies, tupleDependencies);
}
}
}
},
};

File diff suppressed because one or more lines are too long

View File

@@ -11,37 +11,18 @@ from typing import ( # pylint: disable=unused-import
Union,
)
from eth_utils import to_checksum_address
from mypy_extensions import TypedDict # pylint: disable=unused-import
from hexbytes import HexBytes
from web3 import Web3
from web3.contract import ContractFunction
from web3.datastructures import AttributeDict
from web3.providers.base import BaseProvider
from zero_ex.contract_wrappers._base_contract_wrapper import BaseContractWrapper
from zero_ex.contract_wrappers.bases import ContractMethod, Validator
from zero_ex.contract_wrappers.tx_params import TxParams
class LibDummyValidatorBase:
"""Base class for validating inputs to LibDummy methods."""
def __init__(
self,
provider: BaseProvider,
contract_address: str,
private_key: str = None,
):
"""Initialize the instance."""
def assert_valid(
self, method_name: str, parameter_name: str, argument_value: Any
):
"""Raise an exception if method input is not valid.
:param method_name: Name of the method whose input is to be validated.
:param parameter_name: Name of the parameter whose input is to be
validated.
:param argument_value: Value of argument to parameter to be validated.
"""
# Try to import a custom validator class definition; if there isn't one,
# declare one that we can instantiate for the default argument to the
# constructor for LibDummy below.
@@ -53,15 +34,17 @@ try:
)
except ImportError:
class LibDummyValidator(LibDummyValidatorBase): # type: ignore
class LibDummyValidator( # type: ignore
Validator
):
"""No-op input validator."""
# pylint: disable=too-many-public-methods
class LibDummy(BaseContractWrapper):
# pylint: disable=too-many-public-methods,too-many-instance-attributes
class LibDummy:
"""Wrapper class for LibDummy Solidity contract."""
def __init__(
@@ -69,35 +52,24 @@ class LibDummy(BaseContractWrapper):
provider: BaseProvider,
contract_address: str,
validator: LibDummyValidator = None,
private_key: str = None,
):
"""Get an instance of wrapper for smart contract.
:param provider: instance of :class:`web3.providers.base.BaseProvider`
:param contract_address: where the contract has been deployed
:param private_key: If specified, transactions will be signed locally,
via Web3.py's `eth.account.signTransaction()`:code:, before being
sent via `eth.sendRawTransaction()`:code:.
:param validator: for validation of method inputs.
"""
super().__init__(
provider=provider,
contract_address=contract_address,
private_key=private_key,
)
self.contract_address = contract_address
if not validator:
validator = LibDummyValidator(provider, contract_address, private_key)
validator = LibDummyValidator(provider, contract_address)
self.validator = validator
self._web3_eth = Web3( # type: ignore # pylint: disable=no-member
provider
).eth
def _get_contract_instance(self, token_address):
"""Get an instance of the smart contract at a specific address.
functions = self._web3_eth.contract(address=to_checksum_address(contract_address), abi=LibDummy.abi()).functions
:returns: contract object
"""
return self._contract_instance(
address=token_address, abi=LibDummy.abi()
)
@staticmethod
def abi():

View File

@@ -11,37 +11,18 @@ from typing import ( # pylint: disable=unused-import
Union,
)
from eth_utils import to_checksum_address
from mypy_extensions import TypedDict # pylint: disable=unused-import
from hexbytes import HexBytes
from web3 import Web3
from web3.contract import ContractFunction
from web3.datastructures import AttributeDict
from web3.providers.base import BaseProvider
from zero_ex.contract_wrappers._base_contract_wrapper import BaseContractWrapper
from zero_ex.contract_wrappers.bases import ContractMethod, Validator
from zero_ex.contract_wrappers.tx_params import TxParams
class TestLibDummyValidatorBase:
"""Base class for validating inputs to TestLibDummy methods."""
def __init__(
self,
provider: BaseProvider,
contract_address: str,
private_key: str = None,
):
"""Initialize the instance."""
def assert_valid(
self, method_name: str, parameter_name: str, argument_value: Any
):
"""Raise an exception if method input is not valid.
:param method_name: Name of the method whose input is to be validated.
:param parameter_name: Name of the parameter whose input is to be
validated.
:param argument_value: Value of argument to parameter to be validated.
"""
# Try to import a custom validator class definition; if there isn't one,
# declare one that we can instantiate for the default argument to the
# constructor for TestLibDummy below.
@@ -53,62 +34,25 @@ try:
)
except ImportError:
class TestLibDummyValidator(TestLibDummyValidatorBase): # type: ignore
class TestLibDummyValidator( # type: ignore
Validator
):
"""No-op input validator."""
# pylint: disable=too-many-public-methods
class TestLibDummy(BaseContractWrapper):
"""Wrapper class for TestLibDummy Solidity contract."""
class PublicAddConstantMethod(ContractMethod):
"""Various interfaces to the publicAddConstant method."""
def __init__(
self,
provider: BaseProvider,
contract_address: str,
validator: TestLibDummyValidator = None,
private_key: str = None,
):
"""Get an instance of wrapper for smart contract.
def __init__(self, provider: BaseProvider, contract_address: str, contract_function: ContractFunction, validator: Validator=None):
"""Persist instance data."""
super().__init__(provider, contract_address, validator)
self.underlying_method = contract_function
:param provider: instance of :class:`web3.providers.base.BaseProvider`
:param contract_address: where the contract has been deployed
:param private_key: If specified, transactions will be signed locally,
via Web3.py's `eth.account.signTransaction()`:code:, before being
sent via `eth.sendRawTransaction()`:code:.
"""
super().__init__(
provider=provider,
contract_address=contract_address,
private_key=private_key,
)
if not validator:
validator = TestLibDummyValidator(provider, contract_address, private_key)
self.validator = validator
def _get_contract_instance(self, token_address):
"""Get an instance of the smart contract at a specific address.
:returns: contract object
"""
return self._contract_instance(
address=token_address, abi=TestLibDummy.abi()
)
def public_add_constant(
self,
x: int,
tx_params: Optional[TxParams] = None,
) -> int:
"""Execute underlying, same-named contract method.
:param tx_params: transaction parameters
"""
def validate_and_normalize_inputs(self, x: int):
"""Validate the inputs to the publicAddConstant method."""
self.validator.assert_valid(
method_name='publicAddConstant',
parameter_name='x',
@@ -116,27 +60,44 @@ class TestLibDummy(BaseContractWrapper):
)
# safeguard against fractional inputs
x = int(x)
func = self._get_contract_instance(
self.contract_address
).functions.publicAddConstant(
x
)
return self._invoke_function_call(
func=func,
tx_params=tx_params,
view_only=True
)
return (x)
def public_add_one(
self,
x: int,
tx_params: Optional[TxParams] = None,
) -> int:
"""Execute underlying, same-named contract method.
def call(self, x: int, tx_params: Optional[TxParams] = None) -> int:
"""Execute underlying contract method via eth_call.
:param tx_params: transaction parameters
"""
(x) = self.validate_and_normalize_inputs(x)
tx_params = super().normalize_tx_params(tx_params)
return self.underlying_method(x).call(tx_params.as_dict())
def send_transaction(self, x: int, tx_params: Optional[TxParams] = None) -> Union[HexBytes, bytes]:
"""Execute underlying contract method via eth_sendTransaction.
:param tx_params: transaction parameters
"""
(x) = self.validate_and_normalize_inputs(x)
tx_params = super().normalize_tx_params(tx_params)
return self.underlying_method(x).transact(tx_params.as_dict())
def estimate_gas(self, x: int, tx_params: Optional[TxParams] = None) -> int:
"""Estimate gas consumption of method call."""
(x) = self.validate_and_normalize_inputs(x)
tx_params = super().normalize_tx_params(tx_params)
return self.underlying_method(x).estimateGas(tx_params.as_dict())
class PublicAddOneMethod(ContractMethod):
"""Various interfaces to the publicAddOne method."""
def __init__(self, provider: BaseProvider, contract_address: str, contract_function: ContractFunction, validator: Validator=None):
"""Persist instance data."""
super().__init__(provider, contract_address, validator)
self.underlying_method = contract_function
def validate_and_normalize_inputs(self, x: int):
"""Validate the inputs to the publicAddOne method."""
self.validator.assert_valid(
method_name='publicAddOne',
parameter_name='x',
@@ -144,16 +105,75 @@ class TestLibDummy(BaseContractWrapper):
)
# safeguard against fractional inputs
x = int(x)
func = self._get_contract_instance(
self.contract_address
).functions.publicAddOne(
x
)
return self._invoke_function_call(
func=func,
tx_params=tx_params,
view_only=True
)
return (x)
def call(self, x: int, tx_params: Optional[TxParams] = None) -> int:
"""Execute underlying contract method via eth_call.
:param tx_params: transaction parameters
"""
(x) = self.validate_and_normalize_inputs(x)
tx_params = super().normalize_tx_params(tx_params)
return self.underlying_method(x).call(tx_params.as_dict())
def send_transaction(self, x: int, tx_params: Optional[TxParams] = None) -> Union[HexBytes, bytes]:
"""Execute underlying contract method via eth_sendTransaction.
:param tx_params: transaction parameters
"""
(x) = self.validate_and_normalize_inputs(x)
tx_params = super().normalize_tx_params(tx_params)
return self.underlying_method(x).transact(tx_params.as_dict())
def estimate_gas(self, x: int, tx_params: Optional[TxParams] = None) -> int:
"""Estimate gas consumption of method call."""
(x) = self.validate_and_normalize_inputs(x)
tx_params = super().normalize_tx_params(tx_params)
return self.underlying_method(x).estimateGas(tx_params.as_dict())
# pylint: disable=too-many-public-methods,too-many-instance-attributes
class TestLibDummy:
"""Wrapper class for TestLibDummy Solidity contract."""
public_add_constant: PublicAddConstantMethod
"""Constructor-initialized instance of
:class:`PublicAddConstantMethod`.
"""
public_add_one: PublicAddOneMethod
"""Constructor-initialized instance of
:class:`PublicAddOneMethod`.
"""
def __init__(
self,
provider: BaseProvider,
contract_address: str,
validator: TestLibDummyValidator = None,
):
"""Get an instance of wrapper for smart contract.
:param provider: instance of :class:`web3.providers.base.BaseProvider`
:param contract_address: where the contract has been deployed
:param validator: for validation of method inputs.
"""
self.contract_address = contract_address
if not validator:
validator = TestLibDummyValidator(provider, contract_address)
self._web3_eth = Web3( # type: ignore # pylint: disable=no-member
provider
).eth
functions = self._web3_eth.contract(address=to_checksum_address(contract_address), abi=TestLibDummy.abi()).functions
self.public_add_constant = PublicAddConstantMethod(provider, contract_address, functions.publicAddConstant, validator)
self.public_add_one = PublicAddOneMethod(provider, contract_address, functions.publicAddOne, validator)
@staticmethod
def abi():

View File

@@ -45,8 +45,10 @@ export class LibDummyContract extends BaseContract {
const bytecode = artifact.compilerOutput.evm.bytecode.object;
const abi = artifact.compilerOutput.abi;
const logDecodeDependenciesAbiOnly: { [contractName: string]: ContractAbi } = {};
for (const key of Object.keys(logDecodeDependencies)) {
logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi;
if (Object.keys(logDecodeDependencies) !== undefined) {
for (const key of Object.keys(logDecodeDependencies)) {
logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi;
}
}
return LibDummyContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly);
}

View File

@@ -28,6 +28,11 @@ import * as ethers from 'ethers';
// tslint:disable-next-line:class-name
export class TestLibDummyContract extends BaseContract {
public publicAddConstant = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
*/
async callAsync(x: BigNumber, callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<BigNumber> {
assert.isBigNumber('x', x);
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
@@ -60,14 +65,38 @@ export class TestLibDummyContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(x: BigNumber): string {
assert.isBigNumber('x', x);
const self = (this as any) as TestLibDummyContract;
const abiEncodedTransactionData = self._strictEncodeArguments('publicAddConstant(uint256)', [x]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): BigNumber {
const self = (this as any) as TestLibDummyContract;
const abiEncoder = self._lookupAbiEncoder('publicAddConstant(uint256)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<BigNumber>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): BigNumber {
const self = (this as any) as TestLibDummyContract;
const abiEncoder = self._lookupAbiEncoder('publicAddConstant(uint256)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<BigNumber>(returnData);
return abiDecodedReturnData;
},
};
public publicAddOne = {
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
*/
async callAsync(x: BigNumber, callData: Partial<CallData> = {}, defaultBlock?: BlockParam): Promise<BigNumber> {
assert.isBigNumber('x', x);
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
@@ -100,12 +129,31 @@ export class TestLibDummyContract extends BaseContract {
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
*/
getABIEncodedTransactionData(x: BigNumber): string {
assert.isBigNumber('x', x);
const self = (this as any) as TestLibDummyContract;
const abiEncodedTransactionData = self._strictEncodeArguments('publicAddOne(uint256)', [x]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(callData: string): BigNumber {
const self = (this as any) as TestLibDummyContract;
const abiEncoder = self._lookupAbiEncoder('publicAddOne(uint256)');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<BigNumber>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(returnData: string): BigNumber {
const self = (this as any) as TestLibDummyContract;
const abiEncoder = self._lookupAbiEncoder('publicAddOne(uint256)');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<BigNumber>(returnData);
return abiDecodedReturnData;
},
};
public static async deployFrom0xArtifactAsync(
artifact: ContractArtifact | SimpleContractArtifact,
@@ -125,8 +173,10 @@ export class TestLibDummyContract extends BaseContract {
const bytecode = artifact.compilerOutput.evm.bytecode.object;
const abi = artifact.compilerOutput.abi;
const logDecodeDependenciesAbiOnly: { [contractName: string]: ContractAbi } = {};
for (const key of Object.keys(logDecodeDependencies)) {
logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi;
if (Object.keys(logDecodeDependencies) !== undefined) {
for (const key of Object.keys(logDecodeDependencies)) {
logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi;
}
}
return TestLibDummyContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly);
}

File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More