Compare commits
459 Commits
@0xproject
...
@0x/react-
Author | SHA1 | Date | |
---|---|---|---|
|
8b62b350b1 | ||
|
71d1e6b0ec | ||
|
7e49db2301 | ||
|
4b95e3d684 | ||
|
392d339443 | ||
|
ece76e5874 | ||
|
8cb6d99f17 | ||
|
ac377490dc | ||
|
058c887353 | ||
|
0affc7682f | ||
|
1c68bdabaa | ||
|
683c6f22af | ||
|
8c6de7f69d | ||
|
4bf50a0496 | ||
|
745d368130 | ||
|
aa4a474e1d | ||
|
ff99f84f15 | ||
|
10ff723287 | ||
|
56ef712d26 | ||
|
2735fb4fa6 | ||
|
88c929a408 | ||
|
9f924e459c | ||
|
9e8bca69a8 | ||
|
325af82217 | ||
|
f8876ab60b | ||
|
47dc384ea3 | ||
|
e7c6f2a357 | ||
|
56cb2470cc | ||
|
ea65fa4f65 | ||
|
d5daa68703 | ||
|
28863f9a6f | ||
|
cdd650d0eb | ||
|
bd8ba14bf4 | ||
|
6ab6a9aa2b | ||
|
d0df074721 | ||
|
612e8db930 | ||
|
376034ac7e | ||
|
95775dca1f | ||
|
86aa5f9643 | ||
|
02cf99fa36 | ||
|
6ea386a7af | ||
|
1d38b75d6f | ||
|
01b98c3ed0 | ||
|
6cf8d57aee | ||
|
7b43cd14b3 | ||
|
f2f7598c0e | ||
|
ae4f1a093a | ||
|
2b495a7935 | ||
|
155858de6e | ||
|
d052342df7 | ||
|
32fa1bcc38 | ||
|
187bbc7fc1 | ||
|
d46b288733 | ||
|
dfc5d7d860 | ||
|
1d07949087 | ||
|
db77cd10c5 | ||
|
f36352be47 | ||
|
18c9907d6f | ||
|
ac68f8db44 | ||
|
5ec4b27200 | ||
|
b2012bf161 | ||
|
81505ba56c | ||
|
75e3b44d9e | ||
|
84057934c6 | ||
|
bdae4ba2a2 | ||
|
87fabbb943 | ||
|
a31f3b542f | ||
|
f7de26f65c | ||
|
852f50d1a0 | ||
|
f3f97896ed | ||
|
7c87d2e38b | ||
|
03b20eed29 | ||
|
4d275cc591 | ||
|
e18f66e5b7 | ||
|
4ca89fc9f1 | ||
|
f2e5a9635b | ||
|
c767404ad0 | ||
|
492df3108c | ||
|
7db53cf92c | ||
|
7fab0a5a86 | ||
|
41bb38a776 | ||
|
b7d7c5f38b | ||
|
0ecaa90ffd | ||
|
abc00b05c3 | ||
|
d87643fdfa | ||
|
bd00f1279b | ||
|
9176e535aa | ||
|
7d9009bb96 | ||
|
78e6063d92 | ||
|
0013bafc62 | ||
|
336e456984 | ||
|
32beeae2f0 | ||
|
eda0b3e693 | ||
|
35b001b081 | ||
|
8ba65346d4 | ||
|
009b5b575c | ||
|
d2adbc3647 | ||
|
6a89935e3b | ||
|
62f4bb2117 | ||
|
ce43724bd4 | ||
|
18c31a3bc0 | ||
|
c328616330 | ||
|
2610868589 | ||
|
fdefa5952c | ||
|
7f2636fd05 | ||
|
fb7d0b9d0b | ||
|
dbf5be6c21 | ||
|
aa1085c8f3 | ||
|
55be070dcf | ||
|
2c286ad897 | ||
|
4976b34738 | ||
|
7aab4d10de | ||
|
2305109170 | ||
|
9bae3e51d9 | ||
|
c84c92663d | ||
|
c333d093b5 | ||
|
55a3bc8cb6 | ||
|
e6e883e05a | ||
|
17fb4d5b57 | ||
|
05f7b73307 | ||
|
bf51728466 | ||
|
6ad98420a0 | ||
|
afe6181757 | ||
|
ce68e20e82 | ||
|
f35156517d | ||
|
72f5719b34 | ||
|
be45a30851 | ||
|
13f8801e08 | ||
|
ad235912d7 | ||
|
6ff35172d6 | ||
|
e624587050 | ||
|
5938e8a52d | ||
|
fca5260eb1 | ||
|
021041165a | ||
|
6c9277867d | ||
|
75b0781969 | ||
|
eab88cbe7c | ||
|
2e56e2cc05 | ||
|
8cffe65047 | ||
|
5bdfad9b41 | ||
|
3c5812c5d2 | ||
|
d268e19124 | ||
|
875f621f20 | ||
|
f2e5fd8846 | ||
|
5509bf5aeb | ||
|
2c63909d5d | ||
|
18667d739c | ||
|
6f8e98e537 | ||
|
fa18db84d9 | ||
|
05bf7a8280 | ||
|
f8edef66e4 | ||
|
b0a2cacd82 | ||
|
e093864bff | ||
|
ac3bfdfe5f | ||
|
fcf3451448 | ||
|
38b146c395 | ||
|
43f8f2abbd | ||
|
fb0e0473de | ||
|
45ff83d852 | ||
|
e3af06ab10 | ||
|
e7130af6a9 | ||
|
be1a597250 | ||
|
f13d061dd2 | ||
|
00db096d2e | ||
|
7325e16698 | ||
|
14b47f3a9f | ||
|
f0e4837983 | ||
|
003ab1e5b3 | ||
|
24673be1cd | ||
|
7a6cace1ec | ||
|
8dc73d3d85 | ||
|
d76d8abc1d | ||
|
c83dec22c9 | ||
|
974ec23ecd | ||
|
68f150eff2 | ||
|
0e1cd9784b | ||
|
6d79e30266 | ||
|
1e9ea09f08 | ||
|
fa346d9461 | ||
|
33e65c322e | ||
|
770cf52933 | ||
|
1b8b2c0b9b | ||
|
6c8fb370dc | ||
|
a48e0a08bf | ||
|
ecdd6e3303 | ||
|
17c6661e2d | ||
|
141121004c | ||
|
3af7d1ad02 | ||
|
255da32d29 | ||
|
29063cab18 | ||
|
3da032fb24 | ||
|
d0b37fcab5 | ||
|
57d9fcf9e5 | ||
|
2bd7b0f66b | ||
|
8f0ceaf1d8 | ||
|
1da3604351 | ||
|
3a7bb97ad1 | ||
|
2aa73fc839 | ||
|
33335a6791 | ||
|
5b1b423b5e | ||
|
90f5e4d197 | ||
|
026ad1f9a1 | ||
|
81c4887241 | ||
|
20d60e2368 | ||
|
58ad7d7caf | ||
|
af49514397 | ||
|
2aa4761d6d | ||
|
83a36aff3f | ||
|
8b8c958203 | ||
|
6bf27ac57f | ||
|
ce151f630d | ||
|
96d145f54f | ||
|
c9a0c7872d | ||
|
a5e435d831 | ||
|
6ada38248e | ||
|
40512ea608 | ||
|
60208091a4 | ||
|
29437c5761 | ||
|
79db7147a4 | ||
|
b3a323efa1 | ||
|
bf9af95654 | ||
|
eee0640b07 | ||
|
4298da118f | ||
|
bd763ebb34 | ||
|
3fbf9c4285 | ||
|
23fb8dab13 | ||
|
9b1f765ced | ||
|
d85daab967 | ||
|
11941b08b6 | ||
|
6f77b90836 | ||
|
2b2f5d6169 | ||
|
1d30a2f91d | ||
|
6baadc746e | ||
|
69e9dbd683 | ||
|
e0e011eb66 | ||
|
dc56ce4549 | ||
|
0aef2c8ade | ||
|
7102a23b0a | ||
|
f39541436a | ||
|
ccf021b8bf | ||
|
025614a7fd | ||
|
22abd1dfcf | ||
|
a424c2adfa | ||
|
55f9348d0a | ||
|
2afa38c927 | ||
|
92fd0a9d24 | ||
|
a5eb346dd1 | ||
|
a4604cb2f2 | ||
|
11033c78f5 | ||
|
f3391e1250 | ||
|
09c5ae4e65 | ||
|
cd04a21e29 | ||
|
3ca9439481 | ||
|
36f202f7b4 | ||
|
a86ca6257f | ||
|
16386bc99e | ||
|
de20ef1a49 | ||
|
03b235bb42 | ||
|
1c92ae0ed0 | ||
|
0edd9b32ba | ||
|
63652df3b9 | ||
|
5c76c8586d | ||
|
f3cba233ad | ||
|
dcdc411ab7 | ||
|
7f217dcb3c | ||
|
295a8c760a | ||
|
1cfcc82ea9 | ||
|
a1a0d120be | ||
|
2e3624d888 | ||
|
9b147f1495 | ||
|
636ce6331b | ||
|
8941b6cee5 | ||
|
e4351789d2 | ||
|
19f61906d3 | ||
|
a5a033c359 | ||
|
50442c3ebb | ||
|
9fe88b2146 | ||
|
c8e7d225ca | ||
|
0aa7bfab0d | ||
|
7bc9cd8c94 | ||
|
0a3c543d5d | ||
|
01ccd8ff1a | ||
|
f73e6a75b1 | ||
|
a300a451c8 | ||
|
2a95d3269d | ||
|
c8fd1ae05c | ||
|
19a657c38b | ||
|
7418932432 | ||
|
aec0dd3835 | ||
|
fb882b0c77 | ||
|
6c0d317380 | ||
|
0fd158ac64 | ||
|
a165f5d25b | ||
|
2bd8cbb80c | ||
|
afb34da729 | ||
|
402089db4e | ||
|
8155d311af | ||
|
cd8e6d9cdf | ||
|
f2fdb6e47d | ||
|
941448d65c | ||
|
764f402eb9 | ||
|
bd06ebde8d | ||
|
fbd7115500 | ||
|
f93774f855 | ||
|
d21e6f3aaf | ||
|
22160df2d2 | ||
|
31ee8870b8 | ||
|
9876f6cc34 | ||
|
6f600029a2 | ||
|
1bc4d47663 | ||
|
6bfe7d7b7e | ||
|
024bcf492d | ||
|
75b9e63919 | ||
|
6c9f7839c3 | ||
|
7f554303b4 | ||
|
9e8031d5e3 | ||
|
3ac9dac4f0 | ||
|
9654397b29 | ||
|
34c00eaeb3 | ||
|
e1236a4846 | ||
|
e5192507ab | ||
|
2e1222556f | ||
|
9171f9ec60 | ||
|
d0fed1ae46 | ||
|
ee0f2e46ee | ||
|
c833b4f494 | ||
|
bd3f101ab8 | ||
|
f9f8e06c1c | ||
|
cb1311ecc5 | ||
|
9ba00a1077 | ||
|
405234133b | ||
|
6cc9631ef6 | ||
|
2966ab12e0 | ||
|
3ce665eeab | ||
|
03bfc7dd40 | ||
|
a5d0066d00 | ||
|
df7210163a | ||
|
ded6742ddd | ||
|
fa6bd34899 | ||
|
5f2cd33da0 | ||
|
e0355a2e39 | ||
|
f7aee9c7a9 | ||
|
e7de4b953f | ||
|
d98de363eb | ||
|
055763cceb | ||
|
60ba8d57d4 | ||
|
75d274f330 | ||
|
d7b6d8222f | ||
|
1eb8d17ce3 | ||
|
6e462b7dba | ||
|
3e2fe40a11 | ||
|
2a82ff48c0 | ||
|
07926ded6e | ||
|
adcfaa2e80 | ||
|
c5084f023a | ||
|
bf0437324d | ||
|
1001dfcc30 | ||
|
98f8c77494 | ||
|
d9b7aa2e4b | ||
|
0cfe5637c0 | ||
|
119f8c9449 | ||
|
b04b649ec0 | ||
|
e2220a939f | ||
|
831b4a1193 | ||
|
d2e4a150d9 | ||
|
00eb3211c9 | ||
|
1e3ab76e9a | ||
|
ba2ba628e8 | ||
|
a8b01fedb1 | ||
|
85c34b17aa | ||
|
85045267fe | ||
|
c9bfb86960 | ||
|
3991e66a58 | ||
|
4b8348da8c | ||
|
48e7aa6e77 | ||
|
15f20cc18e | ||
|
700b7068a1 | ||
|
d0b2b4d0aa | ||
|
4184c5db85 | ||
|
7197f26494 | ||
|
46764c2d3f | ||
|
a7955c0964 | ||
|
1bef42cdcb | ||
|
8d6bffa96c | ||
|
72b1c60f39 | ||
|
751e8eafe4 | ||
|
437612f8b8 | ||
|
ab855cdd1c | ||
|
688325491f | ||
|
6d8427a024 | ||
|
80a6e6fe8d | ||
|
55d61b0dc7 | ||
|
f13c482161 | ||
|
188564a343 | ||
|
773220f840 | ||
|
0c80fea821 | ||
|
4fb7b35153 | ||
|
c07412a992 | ||
|
0c99680396 | ||
|
91afc37d2a | ||
|
b79e3eaec6 | ||
|
94766cbe19 | ||
|
d435341f9b | ||
|
c42b340042 | ||
|
3a9791e794 | ||
|
0d57ed6c93 | ||
|
457ed57d70 | ||
|
67a2359014 | ||
|
136ef38277 | ||
|
42f6842844 | ||
|
8daf2df6e6 | ||
|
6a33c4685e | ||
|
0febb085c5 | ||
|
011cadc1ff | ||
|
733bb28c1c | ||
|
3d1c2cb296 | ||
|
c7371cc048 | ||
|
7fdde15a5d | ||
|
8651b7bc25 | ||
|
e7ab9938ce | ||
|
9c6bb4245d | ||
|
d4089a1794 | ||
|
822b848dd7 | ||
|
2bf05193b4 | ||
|
b865492137 | ||
|
4d23cf85b9 | ||
|
54f535b375 | ||
|
155a4a8f06 | ||
|
12cfa6b450 | ||
|
10bd255e9d | ||
|
e664768890 | ||
|
ba7de7204d | ||
|
f3ad64aa1c | ||
|
d8c68b000b | ||
|
a8d8f90d23 | ||
|
ac1005b5a8 | ||
|
a9b4027dc4 | ||
|
3504e875cc | ||
|
ce51edcf80 | ||
|
fe38adfa08 | ||
|
92ee7c2194 | ||
|
e6511c9c05 | ||
|
60ef45722c | ||
|
61bfbb86e1 | ||
|
bc8cc35d18 | ||
|
4a524a5f27 | ||
|
ee1e50a722 | ||
|
ca0567ad09 | ||
|
9fd46c7900 | ||
|
4a40edbbb7 | ||
|
2997ba208f | ||
|
cc2000e776 | ||
|
b8241c0f80 | ||
|
fe7a8be98c | ||
|
925d5aa09b | ||
|
a26237da66 | ||
|
791eae24c0 | ||
|
e10561b4a5 | ||
|
e718123478 |
@@ -1,264 +1,350 @@
|
||||
version: 2
|
||||
|
||||
jobs:
|
||||
build:
|
||||
resource_class: medium+
|
||||
docker:
|
||||
- image: circleci/node:9
|
||||
environment:
|
||||
CONTRACTS_COMMIT_HASH: '9ed05f5'
|
||||
working_directory: ~/repo
|
||||
steps:
|
||||
- checkout
|
||||
- run: echo 'export PATH=$HOME/CIRCLE_PROJECT_REPONAME/node_modules/.bin:$PATH' >> $BASH_ENV
|
||||
- run:
|
||||
name: install-yarn
|
||||
command: sudo npm install --global yarn@1.9.4
|
||||
- run:
|
||||
name: yarn
|
||||
command: yarn --frozen-lockfile install || yarn --frozen-lockfile install
|
||||
- run: yarn build:ci:no_website
|
||||
- save_cache:
|
||||
key: repo-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
- ~/repo
|
||||
build-website:
|
||||
docker:
|
||||
- image: circleci/node:9
|
||||
working_directory: ~/repo
|
||||
steps:
|
||||
- restore_cache:
|
||||
keys:
|
||||
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- run: cd packages/website && yarn build
|
||||
test-contracts-ganache:
|
||||
docker:
|
||||
- image: circleci/node:9
|
||||
working_directory: ~/repo
|
||||
steps:
|
||||
- restore_cache:
|
||||
keys:
|
||||
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- run: yarn wsrun test:circleci contracts
|
||||
test-contracts-geth:
|
||||
docker:
|
||||
- image: circleci/node:9
|
||||
- image: 0xorg/devnet
|
||||
working_directory: ~/repo
|
||||
steps:
|
||||
- restore_cache:
|
||||
keys:
|
||||
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
||||
# HACK(albrow): we need to sleep 10 seconds to ensure the devnet is
|
||||
# initialized
|
||||
- run: sleep 10 && TEST_PROVIDER=geth yarn wsrun test contracts
|
||||
test-publish:
|
||||
resource_class: medium+
|
||||
docker:
|
||||
- image: circleci/node:9
|
||||
- image: 0xorg/verdaccio
|
||||
working_directory: ~/repo
|
||||
steps:
|
||||
- restore_cache:
|
||||
keys:
|
||||
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- run: yarn test:publish:circleci
|
||||
test-doc-generation:
|
||||
docker:
|
||||
- image: circleci/node:9
|
||||
working_directory: ~/repo
|
||||
steps:
|
||||
- restore_cache:
|
||||
keys:
|
||||
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- run: yarn test:generate_docs:circleci
|
||||
test-rest:
|
||||
docker:
|
||||
- image: circleci/node:9
|
||||
working_directory: ~/repo
|
||||
steps:
|
||||
- restore_cache:
|
||||
keys:
|
||||
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- run: yarn wsrun test:circleci @0xproject/abi-gen
|
||||
- run: yarn wsrun test:circleci @0xproject/assert
|
||||
- run: yarn wsrun test:circleci @0xproject/base-contract
|
||||
- run: yarn wsrun test:circleci @0xproject/connect
|
||||
- run: yarn wsrun test:circleci @0xproject/contract-wrappers
|
||||
- run: yarn wsrun test:circleci @0xproject/dev-utils
|
||||
- run: yarn wsrun test:circleci @0xproject/json-schemas
|
||||
- run: yarn wsrun test:circleci @0xproject/metacoin
|
||||
- run: yarn wsrun test:circleci @0xproject/order-utils
|
||||
- run: yarn wsrun test:circleci @0xproject/order-watcher
|
||||
- run: yarn wsrun test:circleci @0xproject/sol-compiler
|
||||
- run: yarn wsrun test:circleci @0xproject/sol-cov
|
||||
- run: yarn wsrun test:circleci @0xproject/sol-doc
|
||||
- run: yarn wsrun test:circleci @0xproject/sra-report
|
||||
- run: yarn wsrun test:circleci @0xproject/subproviders
|
||||
- run: yarn wsrun test:circleci @0xproject/web3-wrapper
|
||||
- run: yarn wsrun test:circleci @0xproject/utils
|
||||
- save_cache:
|
||||
key: coverage-abi-gen-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
- ~/repo/packages/abi-gen/coverage/lcov.info
|
||||
- save_cache:
|
||||
key: coverage-assert-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
- ~/repo/packages/assert/coverage/lcov.info
|
||||
- save_cache:
|
||||
key: coverage-base-contract-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
- ~/repo/packages/base-contract/coverage/lcov.info
|
||||
- save_cache:
|
||||
key: coverage-connect-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
- ~/repo/packages/connect/coverage/lcov.info
|
||||
- save_cache:
|
||||
key: coverage-contract-wrappers-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
- ~/repo/packages/contract-wrappers/coverage/lcov.info
|
||||
- save_cache:
|
||||
key: coverage-dev-utils-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
- ~/repo/packages/dev-utils/coverage/lcov.info
|
||||
- save_cache:
|
||||
key: coverage-json-schemas-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
- ~/repo/packages/json-schemas/coverage/lcov.info
|
||||
- save_cache:
|
||||
key: coverage-metacoin-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
- ~/repo/packages/metacoin/coverage/lcov.info
|
||||
- save_cache:
|
||||
key: coverage-order-utils-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
- ~/repo/packages/order-utils/coverage/lcov.info
|
||||
- save_cache:
|
||||
key: coverage-order-watcher-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
- ~/repo/packages/order-watcher/coverage/lcov.info
|
||||
- save_cache:
|
||||
key: coverage-sol-compiler-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
- ~/repo/packages/sol-compiler/coverage/lcov.info
|
||||
- save_cache:
|
||||
key: coverage-sol-cov-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
- ~/repo/packages/sol-cov/coverage/lcov.info
|
||||
- save_cache:
|
||||
key: coverage-sol-doc-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
- ~/repo/packages/sol-doc/coverage/lcov.info
|
||||
- save_cache:
|
||||
key: coverage-sra-report-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
- ~/repo/packages/sra-report/coverage/lcov.info
|
||||
- save_cache:
|
||||
key: coverage-subproviders-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
- ~/repo/packages/subproviders/coverage/lcov.info
|
||||
- save_cache:
|
||||
key: coverage-web3-wrapper-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
- ~/repo/packages/web3-wrapper/coverage/lcov.info
|
||||
static-tests:
|
||||
working_directory: ~/repo
|
||||
docker:
|
||||
- image: circleci/node:9
|
||||
steps:
|
||||
- restore_cache:
|
||||
keys:
|
||||
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- run: yarn lerna run lint
|
||||
- run: yarn prettier:ci
|
||||
- run: cd packages/0x.js && yarn build:umd:prod
|
||||
- run: yarn bundlesize
|
||||
submit-coverage:
|
||||
docker:
|
||||
- image: circleci/node:9
|
||||
working_directory: ~/repo
|
||||
steps:
|
||||
- restore_cache:
|
||||
keys:
|
||||
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- restore_cache:
|
||||
keys:
|
||||
- coverage-abi-gen-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- restore_cache:
|
||||
keys:
|
||||
- coverage-assert-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- restore_cache:
|
||||
keys:
|
||||
- coverage-base-contract-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- restore_cache:
|
||||
keys:
|
||||
- coverage-connect-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- restore_cache:
|
||||
keys:
|
||||
- coverage-contract-wrappers-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- restore_cache:
|
||||
keys:
|
||||
- coverage-dev-utils-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- restore_cache:
|
||||
keys:
|
||||
- coverage-json-schemas-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- restore_cache:
|
||||
keys:
|
||||
- coverage-metacoin-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- restore_cache:
|
||||
keys:
|
||||
- coverage-order-utils-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- restore_cache:
|
||||
keys:
|
||||
- coverage-order-watcher-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- restore_cache:
|
||||
keys:
|
||||
- coverage-sol-compiler-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- restore_cache:
|
||||
keys:
|
||||
- coverage-sol-cov-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- restore_cache:
|
||||
keys:
|
||||
- coverage-sol-doc-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- restore_cache:
|
||||
keys:
|
||||
- coverage-sra-report-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- restore_cache:
|
||||
keys:
|
||||
- coverage-subproviders-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- restore_cache:
|
||||
keys:
|
||||
- coverage-web3-wrapper-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- restore_cache:
|
||||
keys:
|
||||
- coverage-contracts-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- run: yarn report_coverage
|
||||
build:
|
||||
resource_class: medium+
|
||||
docker:
|
||||
- image: circleci/node:9
|
||||
environment:
|
||||
CONTRACTS_COMMIT_HASH: '9ed05f5'
|
||||
working_directory: ~/repo
|
||||
steps:
|
||||
- checkout
|
||||
- run: echo 'export PATH=$HOME/CIRCLE_PROJECT_REPONAME/node_modules/.bin:$PATH' >> $BASH_ENV
|
||||
- run:
|
||||
name: install-yarn
|
||||
command: sudo npm install --global yarn@1.9.4
|
||||
- run:
|
||||
name: yarn
|
||||
command: yarn --frozen-lockfile install || yarn --frozen-lockfile install
|
||||
- run: yarn build:ci:no_website
|
||||
- save_cache:
|
||||
key: repo-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
- ~/repo
|
||||
build-website:
|
||||
resource_class: medium+
|
||||
docker:
|
||||
- image: circleci/node:9
|
||||
working_directory: ~/repo
|
||||
steps:
|
||||
- restore_cache:
|
||||
keys:
|
||||
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- run: cd packages/website && yarn build
|
||||
test-contracts-ganache:
|
||||
docker:
|
||||
- image: circleci/node:9
|
||||
working_directory: ~/repo
|
||||
steps:
|
||||
- restore_cache:
|
||||
keys:
|
||||
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- run: yarn wsrun test:circleci contracts
|
||||
test-contracts-geth:
|
||||
docker:
|
||||
- image: circleci/node:9
|
||||
- image: 0xorg/devnet
|
||||
working_directory: ~/repo
|
||||
steps:
|
||||
- restore_cache:
|
||||
keys:
|
||||
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
||||
# HACK(albrow): we need to sleep 10 seconds to ensure the devnet is
|
||||
# initialized
|
||||
- run: sleep 10 && TEST_PROVIDER=geth yarn wsrun test contracts
|
||||
test-publish:
|
||||
resource_class: medium+
|
||||
docker:
|
||||
- image: circleci/node:9
|
||||
- image: 0xorg/verdaccio
|
||||
working_directory: ~/repo
|
||||
steps:
|
||||
- restore_cache:
|
||||
keys:
|
||||
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- run: yarn test:publish:circleci
|
||||
test-doc-generation:
|
||||
docker:
|
||||
- image: circleci/node:9
|
||||
working_directory: ~/repo
|
||||
steps:
|
||||
- restore_cache:
|
||||
keys:
|
||||
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- run: yarn test:generate_docs:circleci
|
||||
test-rest:
|
||||
docker:
|
||||
- image: circleci/node:9
|
||||
working_directory: ~/repo
|
||||
steps:
|
||||
- restore_cache:
|
||||
keys:
|
||||
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- run: yarn wsrun test:circleci @0x/abi-gen
|
||||
- run: yarn wsrun test:circleci @0x/assert
|
||||
- run: yarn wsrun test:circleci @0x/base-contract
|
||||
- run: yarn wsrun test:circleci @0x/connect
|
||||
- run: yarn wsrun test:circleci @0x/contract-wrappers
|
||||
- run: yarn wsrun test:circleci @0x/dev-utils
|
||||
- run: yarn wsrun test:circleci @0x/json-schemas
|
||||
- run: yarn wsrun test:circleci @0x/metacoin
|
||||
- run: yarn wsrun test:circleci @0x/order-utils
|
||||
- run: yarn wsrun test:circleci @0x/order-watcher
|
||||
- run: yarn wsrun test:circleci @0x/sol-compiler
|
||||
- run: yarn wsrun test:circleci @0x/sol-cov
|
||||
- run: yarn wsrun test:circleci @0x/sol-doc
|
||||
- run: yarn wsrun test:circleci @0x/subproviders
|
||||
- run: yarn wsrun test:circleci @0x/web3-wrapper
|
||||
- run: yarn wsrun test:circleci @0x/utils
|
||||
- run: yarn wsrun test:circleci @0x/instant
|
||||
- save_cache:
|
||||
key: coverage-abi-gen-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
- ~/repo/packages/abi-gen/coverage/lcov.info
|
||||
- save_cache:
|
||||
key: coverage-assert-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
- ~/repo/packages/assert/coverage/lcov.info
|
||||
- save_cache:
|
||||
key: coverage-base-contract-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
- ~/repo/packages/base-contract/coverage/lcov.info
|
||||
- save_cache:
|
||||
key: coverage-connect-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
- ~/repo/packages/connect/coverage/lcov.info
|
||||
- save_cache:
|
||||
key: coverage-contract-wrappers-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
- ~/repo/packages/contract-wrappers/coverage/lcov.info
|
||||
- save_cache:
|
||||
key: coverage-dev-utils-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
- ~/repo/packages/dev-utils/coverage/lcov.info
|
||||
- save_cache:
|
||||
key: coverage-json-schemas-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
- ~/repo/packages/json-schemas/coverage/lcov.info
|
||||
- save_cache:
|
||||
key: coverage-metacoin-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
- ~/repo/packages/metacoin/coverage/lcov.info
|
||||
- save_cache:
|
||||
key: coverage-order-utils-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
- ~/repo/packages/order-utils/coverage/lcov.info
|
||||
- save_cache:
|
||||
key: coverage-order-watcher-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
- ~/repo/packages/order-watcher/coverage/lcov.info
|
||||
- save_cache:
|
||||
key: coverage-sol-compiler-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
- ~/repo/packages/sol-compiler/coverage/lcov.info
|
||||
- save_cache:
|
||||
key: coverage-sol-cov-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
- ~/repo/packages/sol-cov/coverage/lcov.info
|
||||
- save_cache:
|
||||
key: coverage-sol-doc-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
- ~/repo/packages/sol-doc/coverage/lcov.info
|
||||
- save_cache:
|
||||
key: coverage-subproviders-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
- ~/repo/packages/subproviders/coverage/lcov.info
|
||||
- save_cache:
|
||||
key: coverage-web3-wrapper-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
- ~/repo/packages/web3-wrapper/coverage/lcov.info
|
||||
test-python:
|
||||
working_directory: ~/repo
|
||||
docker:
|
||||
- image: circleci/python
|
||||
steps:
|
||||
- checkout
|
||||
- run: sudo chown -R circleci:circleci /usr/local/bin
|
||||
- run: sudo chown -R circleci:circleci /usr/local/lib/python3.7/site-packages
|
||||
- restore_cache:
|
||||
key: deps9-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- run:
|
||||
command: |
|
||||
cd python-packages/order_utils
|
||||
python -m ensurepip
|
||||
python -m pip install -e .[dev]
|
||||
- save_cache:
|
||||
key: deps9-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
- '/usr/local/bin'
|
||||
- '/usr/local/lib/python3.7/site-packages'
|
||||
- '.eggs'
|
||||
- '.mypy_cache'
|
||||
- '.pytest_cache'
|
||||
- '.tox'
|
||||
- run:
|
||||
command: |
|
||||
cd python-packages/order_utils
|
||||
coverage run setup.py test
|
||||
- save_cache:
|
||||
key: coverage-python-order-utils-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
- ~/repo/python-packages/order_utils/.coverage
|
||||
test-rest-python:
|
||||
working_directory: ~/repo
|
||||
docker:
|
||||
- image: circleci/python
|
||||
steps:
|
||||
- checkout
|
||||
- run: sudo chown -R circleci:circleci /usr/local/bin
|
||||
- run: sudo chown -R circleci:circleci /usr/local/lib/python3.7/site-packages
|
||||
- restore_cache:
|
||||
key: deps9-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- run:
|
||||
command: |
|
||||
cd python-packages/order_utils
|
||||
python -m ensurepip
|
||||
python -m pip install -e .[dev]
|
||||
- save_cache:
|
||||
key: deps9-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
- '/usr/local/bin'
|
||||
- '/usr/local/lib/python3.7/site-packages'
|
||||
- '.eggs'
|
||||
- '.mypy_cache'
|
||||
- '.pytest_cache'
|
||||
- '.tox'
|
||||
- run:
|
||||
command: |
|
||||
cd python-packages/order_utils
|
||||
tox
|
||||
static-tests-python:
|
||||
working_directory: ~/repo
|
||||
docker:
|
||||
- image: circleci/python
|
||||
steps:
|
||||
- checkout
|
||||
- run: sudo chown -R circleci:circleci /usr/local/bin
|
||||
- run: sudo chown -R circleci:circleci /usr/local/lib/python3.7/site-packages
|
||||
- restore_cache:
|
||||
key: deps9-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- run:
|
||||
command: |
|
||||
cd python-packages/order_utils
|
||||
python -m ensurepip
|
||||
python -m pip install -e .[dev]
|
||||
- save_cache:
|
||||
key: deps9-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
- '/usr/local/bin'
|
||||
- '/usr/local/lib/python3.7/site-packages'
|
||||
- run:
|
||||
command: |
|
||||
cd python-packages/order_utils
|
||||
python setup.py lint
|
||||
static-tests:
|
||||
working_directory: ~/repo
|
||||
docker:
|
||||
- image: circleci/node:9
|
||||
steps:
|
||||
- restore_cache:
|
||||
keys:
|
||||
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- run: yarn lerna run lint
|
||||
- run: yarn prettier:ci
|
||||
- run: cd packages/0x.js && yarn build:umd:prod
|
||||
- run: yarn bundlewatch
|
||||
submit-coverage:
|
||||
docker:
|
||||
- image: circleci/node:9
|
||||
working_directory: ~/repo
|
||||
steps:
|
||||
- restore_cache:
|
||||
keys:
|
||||
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- restore_cache:
|
||||
keys:
|
||||
- coverage-abi-gen-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- restore_cache:
|
||||
keys:
|
||||
- coverage-assert-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- restore_cache:
|
||||
keys:
|
||||
- coverage-base-contract-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- restore_cache:
|
||||
keys:
|
||||
- coverage-connect-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- restore_cache:
|
||||
keys:
|
||||
- coverage-contract-wrappers-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- restore_cache:
|
||||
keys:
|
||||
- coverage-dev-utils-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- restore_cache:
|
||||
keys:
|
||||
- coverage-json-schemas-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- restore_cache:
|
||||
keys:
|
||||
- coverage-metacoin-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- restore_cache:
|
||||
keys:
|
||||
- coverage-order-utils-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- restore_cache:
|
||||
keys:
|
||||
- coverage-order-watcher-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- restore_cache:
|
||||
keys:
|
||||
- coverage-sol-compiler-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- restore_cache:
|
||||
keys:
|
||||
- coverage-sol-cov-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- restore_cache:
|
||||
keys:
|
||||
- coverage-sol-doc-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- restore_cache:
|
||||
keys:
|
||||
- coverage-subproviders-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- restore_cache:
|
||||
keys:
|
||||
- coverage-web3-wrapper-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- restore_cache:
|
||||
keys:
|
||||
- coverage-contracts-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- restore_cache:
|
||||
keys:
|
||||
- coverage-python-order-utils-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- run: yarn report_coverage
|
||||
workflows:
|
||||
version: 2
|
||||
main:
|
||||
jobs:
|
||||
- build
|
||||
- build-website:
|
||||
requires:
|
||||
version: 2
|
||||
main:
|
||||
jobs:
|
||||
- build
|
||||
- test-contracts-ganache:
|
||||
requires:
|
||||
- build
|
||||
- test-contracts-geth:
|
||||
requires:
|
||||
- build
|
||||
- test-rest:
|
||||
requires:
|
||||
- build
|
||||
- static-tests:
|
||||
requires:
|
||||
- build
|
||||
- test-publish:
|
||||
requires:
|
||||
- build
|
||||
- test-doc-generation:
|
||||
requires:
|
||||
- build
|
||||
- submit-coverage:
|
||||
requires:
|
||||
- test-rest
|
||||
- build-website:
|
||||
requires:
|
||||
- build
|
||||
- test-contracts-ganache:
|
||||
requires:
|
||||
- build
|
||||
- test-contracts-geth:
|
||||
requires:
|
||||
- build
|
||||
- test-rest:
|
||||
requires:
|
||||
- build
|
||||
- static-tests:
|
||||
requires:
|
||||
- build
|
||||
- test-publish:
|
||||
requires:
|
||||
- build
|
||||
- test-doc-generation:
|
||||
requires:
|
||||
- build
|
||||
- submit-coverage:
|
||||
requires:
|
||||
- test-rest
|
||||
- test-python
|
||||
- test-python
|
||||
- static-tests-python
|
||||
# skip python tox run for now, as we don't yet have multiple test environments to support.
|
||||
#- test-rest-python
|
||||
|
6
.gitattributes
vendored
6
.gitattributes
vendored
@@ -1 +1,7 @@
|
||||
*.sol linguist-language=Solidity
|
||||
|
||||
# Automatically collapse generated files in GitHub.
|
||||
*.svg linguist-generated
|
||||
packages/contract-artifacts/artifacts/*json linguist-generated
|
||||
packages/abi-gen-wrappers/wrappers/*.ts liguist-generated
|
||||
|
||||
|
34
.gitignore
vendored
34
.gitignore
vendored
@@ -72,39 +72,33 @@ TODO.md
|
||||
.vscode
|
||||
|
||||
packages/website/public/bundle*
|
||||
packages/dev-tools-pages/public/bundle*
|
||||
packages/react-docs/example/public/bundle*
|
||||
|
||||
# server cli
|
||||
packages/testnet-faucets/server/
|
||||
|
||||
# generated contract artifacts/
|
||||
packages/contracts/generated-artifacts/
|
||||
packages/sol-cov/test/fixtures/artifacts/
|
||||
packages/metacoin/artifacts/
|
||||
packages/order-watcher/test/artifacts/
|
||||
packages/contract-wrappers/test/artifacts/
|
||||
packages/contract-wrappers/src/artifacts/
|
||||
packages/order-watcher/src/artifacts/
|
||||
packages/0x.js/src/artifacts/
|
||||
packages/order-utils/src/artifacts/
|
||||
|
||||
# unstable generated contract artifacts:
|
||||
packages/migrations/artifacts/development/
|
||||
|
||||
# generated contract watcher
|
||||
packages/0x.js/src/generated_contract_wrappers/
|
||||
packages/contracts/generated_contract_wrappers/
|
||||
packages/contract-wrappers/src/contract_wrappers/generated/
|
||||
# generated contract wrappers
|
||||
packages/abi-gen-wrappers/wrappers
|
||||
packages/contracts/generated-wrappers/
|
||||
packages/metacoin/src/contract_wrappers
|
||||
packages/fill-scenarios/src/generated_contract_wrappers/
|
||||
packages/order-watcher/src/generated_contract_wrappers/
|
||||
packages/order-utils/src/generated_contract_wrappers/
|
||||
packages/migrations/src/1.0.0/contract_wrappers
|
||||
packages/migrations/src/2.0.0-testnet/contract_wrappers
|
||||
packages/migrations/src/2.0.0/contract_wrappers
|
||||
packages/migrations/src/development/contract_wrappers
|
||||
|
||||
# solc-bin in sol-compiler
|
||||
packages/sol-compiler/solc_bin/
|
||||
|
||||
# Monorepo scripts
|
||||
packages/*/scripts/
|
||||
|
||||
# python stuff
|
||||
.eggs
|
||||
.mypy_cache
|
||||
.tox
|
||||
python-packages/*/build
|
||||
__pycache__
|
||||
python-packages/*/src/*.egg-info
|
||||
python-packages/*/.coverage
|
||||
|
@@ -1,27 +1,13 @@
|
||||
lib
|
||||
.nyc_output
|
||||
/packages/contract-wrappers/src/contract_wrappers/generated/
|
||||
/packages/contracts/generated-wrappers
|
||||
/packages/contracts/generated-artifacts
|
||||
/packages/abi-gen-wrappers/src/generated-wrappers
|
||||
/packages/contract-artifacts/artifacts
|
||||
/packages/json-schemas/schemas
|
||||
/packages/metacoin/src/contract_wrappers
|
||||
/packages/0x.js/src/generated_contract_wrappers/
|
||||
/packages/contracts/generated_contract_wrappers/
|
||||
/packages/fill-scenarios/src/generated_contract_wrappers/
|
||||
/packages/order-watcher/src/generated_contract_wrappers/
|
||||
/packages/order-utils/src/generated_contract_wrappers/
|
||||
/packages/migrations/src/1.0.0/contract_wrappers
|
||||
/packages/migrations/src/2.0.0-testnet/contract_wrappers
|
||||
/packages/migrations/src/2.0.0/contract_wrappers
|
||||
/packages/0x.js/src/artifacts
|
||||
/packages/contracts/src/artifacts
|
||||
/packages/contract-wrappers/src/artifacts
|
||||
/packages/order-watcher/src/artifacts
|
||||
/packages/metacoin/artifacts
|
||||
/packages/sra-spec/public/
|
||||
/packages/contract-wrappers/test/artifacts
|
||||
/packages/order-watcher/test/artifacts
|
||||
/packages/migrations/artifacts/1.0.0
|
||||
/packages/migrations/artifacts/2.0.0-testnet
|
||||
/packages/migrations/artifacts/2.0.0
|
||||
/packages/migrations/artifacts/development
|
||||
package.json
|
||||
scripts/postpublish_utils.js
|
||||
packages/sol-cov/test/fixtures/artifacts
|
||||
|
22
CODEOWNERS
22
CODEOWNERS
@@ -5,4 +5,24 @@
|
||||
# https://git-scm.com/docs/gitignore#_pattern_format
|
||||
|
||||
# Website
|
||||
packages/website/ @BMillman19 @fragosti
|
||||
packages/asset-buyer/ @BMillman19 @fragosti @steveklebanoff
|
||||
packages/instant/ @BMillman19 @fragosti @steveklebanoff
|
||||
packages/website/ @BMillman19 @fragosti @fabioberger @steveklebanoff
|
||||
|
||||
# Dev tools & setup
|
||||
packages/abi-gen/ @LogvinovLeon
|
||||
packages/base-contract/ @LogvinovLeon
|
||||
packages/contract_templates/ @LogvinovLeon
|
||||
packages/dev-utils/ @LogvinovLeon @fabioberger
|
||||
|
||||
packages/ethereum-types/ @LogvinovLeon
|
||||
packages/metacoin/ @LogvinovLeon
|
||||
packages/sol-compiler/ @LogvinovLeon
|
||||
packages/sol-cov/ @LogvinovLeon
|
||||
packages/sol-resolver/ @LogvinovLeon
|
||||
packages/web3-wrapper/ @LogvinovLeon @fabioberger
|
||||
.circleci/ @LogvinovLeon
|
||||
packages/subproviders/ @fabioberger @dekz
|
||||
packages/connect/ @fragosti
|
||||
packages/monorepo-scripts/ @fabioberger
|
||||
packages/order-utils/ @fabioberger @LogvinovLeon
|
||||
|
68
README.md
68
README.md
@@ -20,38 +20,38 @@ If you're developing on 0x now or are interested in using 0x infrastructure in t
|
||||
|
||||
### Published Packages
|
||||
|
||||
| Package | Version | Description |
|
||||
| --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [`0x.js`](/packages/0x.js) | [](https://www.npmjs.com/package/0x.js) | A Javascript library for interacting with the 0x protocol |
|
||||
| [`@0xproject/abi-gen`](/packages/abi-gen) | [](https://www.npmjs.com/package/@0xproject/abi-gen) | Tool to generate TS wrappers from smart contract ABIs |
|
||||
| [`@0xproject/assert`](/packages/assert) | [](https://www.npmjs.com/package/@0xproject/assert) | Type and schema assertions used by our packages |
|
||||
| [`@0xproject/base-contract`](/packages/base-contract) | [](https://www.npmjs.com/package/@0xproject/base-contract) | BaseContract used by auto-generated `abi-gen` wrapper contracts |
|
||||
| [`@0xproject/connect`](/packages/connect) | [](https://www.npmjs.com/package/@0xproject/connect) | A Javascript library for interacting with the Standard Relayer API |
|
||||
| [`@0xproject/dev-utils`](/packages/dev-utils) | [](https://www.npmjs.com/package/@0xproject/dev-utils) | Dev utils to be shared across 0x projects and packages |
|
||||
| [`@0xproject/json-schemas`](/packages/json-schemas) | [](https://www.npmjs.com/package/@0xproject/json-schemas) | 0x-related json schemas |
|
||||
| [`@0xproject/monorepo-scripts`](/packages/monorepo-scripts) | [](https://www.npmjs.com/package/@0xproject/monorepo-scripts) | Monorepo scripts |
|
||||
| [`@0xproject/order-utils`](/packages/order-utils) | [](https://www.npmjs.com/package/@0xproject/order-utils) | A set of utilities for generating, parsing, signing and validating 0x orders. |
|
||||
| [`@0xproject/react-docs`](/packages/react-docs) | [](https://www.npmjs.com/package/@0xproject/react-docs) | React documentation component for rendering TypeDoc & Doxity generated JSON |
|
||||
| [`@0xproject/react-shared`](/packages/react-shared) | [](https://www.npmjs.com/package/@0xproject/react-shared) | 0x shared react components |
|
||||
| [`@0xproject/sol-compiler`](/packages/sol-compiler) | [](https://www.npmjs.com/package/@0xproject/sol-compiler) | A thin wrapper around Solc.js that outputs artifacts, resolves imports, only re-compiles when needed, and other niceties. |
|
||||
| [`@0xproject/sol-cov`](/packages/sol-cov) | [](https://www.npmjs.com/package/@0xproject/sol-cov) | Solidity test coverage tool |
|
||||
| [`@0xproject/sra-spec`](/packages/sra-spec) | [](https://www.npmjs.com/package/@0xproject/sra-spec) | OpenAPI specification for the standard relayer API |
|
||||
| [`@0xproject/sra-report`](/packages/sra-report) | [](https://www.npmjs.com/package/@0xproject/sra-report) | Generate reports for standard relayer API compliance |
|
||||
| [`@0xproject/subproviders`](/packages/subproviders) | [](https://www.npmjs.com/package/@0xproject/subproviders) | Useful web3 subproviders (e.g LedgerSubprovider) |
|
||||
| [`@0xproject/tslint-config`](/packages/tslint-config) | [](https://www.npmjs.com/package/@0xproject/tslint-config) | Custom 0x development TSLint rules |
|
||||
| [`@0xproject/types`](/packages/types) | [](https://www.npmjs.com/package/@0xproject/types) | Shared type declarations |
|
||||
| [`@0xproject/typescript-typings`](/packages/typescript-typings) | [](https://www.npmjs.com/package/@0xproject/typescript-typings) | Repository of types for external packages |
|
||||
| [`@0xproject/utils`](/packages/utils) | [](https://www.npmjs.com/package/@0xproject/utils) | Shared utilities |
|
||||
| [`@0xproject/web3-wrapper`](/packages/web3-wrapper) | [](https://www.npmjs.com/package/@0xproject/web3-wrapper) | Web3 wrapper |
|
||||
| Package | Version | Description |
|
||||
| -------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [`0x.js`](/packages/0x.js) | [](https://www.npmjs.com/package/0x.js) | A Javascript library for interacting with the 0x protocol |
|
||||
| [`@0x/abi-gen`](/packages/abi-gen) | [](https://www.npmjs.com/package/@0x/abi-gen) | Tool to generate TS wrappers from smart contract ABIs |
|
||||
| [`@0x/assert`](/packages/assert) | [](https://www.npmjs.com/package/@0x/assert) | Type and schema assertions used by our packages |
|
||||
| [`@0x/asset-buyer`](/packages/asset-buyer) | [](https://www.npmjs.com/package/@0x/asset-buyer) | Convenience package for discovering and buying assets with Ether. |
|
||||
| [`@0x/base-contract`](/packages/base-contract) | [](https://www.npmjs.com/package/@0x/base-contract) | BaseContract used by auto-generated `abi-gen` wrapper contracts |
|
||||
| [`@0x/connect`](/packages/connect) | [](https://www.npmjs.com/package/@0x/connect) | A Javascript library for interacting with the Standard Relayer API |
|
||||
| [`@0x/dev-utils`](/packages/dev-utils) | [](https://www.npmjs.com/package/@0x/dev-utils) | Dev utils to be shared across 0x projects and packages |
|
||||
| [`@0x/json-schemas`](/packages/json-schemas) | [](https://www.npmjs.com/package/@0x/json-schemas) | 0x-related json schemas |
|
||||
| [`@0x/monorepo-scripts`](/packages/monorepo-scripts) | [](https://www.npmjs.com/package/@0x/monorepo-scripts) | Monorepo scripts |
|
||||
| [`@0x/order-utils`](/packages/order-utils) | [](https://www.npmjs.com/package/@0x/order-utils) | A set of utilities for generating, parsing, signing and validating 0x orders. |
|
||||
| [`@0x/react-docs`](/packages/react-docs) | [](https://www.npmjs.com/package/@0x/react-docs) | React documentation component for rendering TypeDoc & Doxity generated JSON |
|
||||
| [`@0x/react-shared`](/packages/react-shared) | [](https://www.npmjs.com/package/@0x/react-shared) | 0x shared react components |
|
||||
| [`@0x/sol-compiler`](/packages/sol-compiler) | [](https://www.npmjs.com/package/@0x/sol-compiler) | A thin wrapper around Solc.js that outputs artifacts, resolves imports, only re-compiles when needed, and other niceties. |
|
||||
| [`@0x/sol-cov`](/packages/sol-cov) | [](https://www.npmjs.com/package/@0x/sol-cov) | Solidity test coverage tool |
|
||||
| [`@0x/sra-spec`](/packages/sra-spec) | [](https://www.npmjs.com/package/@0x/sra-spec) | OpenAPI specification for the standard relayer API |
|
||||
| [`@0x/subproviders`](/packages/subproviders) | [](https://www.npmjs.com/package/@0x/subproviders) | Useful web3 subproviders (e.g LedgerSubprovider) |
|
||||
| [`@0x/tslint-config`](/packages/tslint-config) | [](https://www.npmjs.com/package/@0x/tslint-config) | Custom 0x development TSLint rules |
|
||||
| [`@0x/types`](/packages/types) | [](https://www.npmjs.com/package/@0x/types) | Shared type declarations |
|
||||
| [`@0x/typescript-typings`](/packages/typescript-typings) | [](https://www.npmjs.com/package/@0x/typescript-typings) | Repository of types for external packages |
|
||||
| [`@0x/utils`](/packages/utils) | [](https://www.npmjs.com/package/@0x/utils) | Shared utilities |
|
||||
| [`@0x/web3-wrapper`](/packages/web3-wrapper) | [](https://www.npmjs.com/package/@0x/web3-wrapper) | Web3 wrapper |
|
||||
|
||||
### Private Packages
|
||||
|
||||
| Package | Description |
|
||||
| --------------------------------------------------------------- | ---------------------------------------------------------------- |
|
||||
| [`@0xproject/contracts`](/packages/contracts) | 0x solidity smart contracts & tests |
|
||||
| [`@0xproject/react-docs-example`](/packages/react-docs-example) | Example documentation site created with `@0xproject/react-docs` |
|
||||
| [`@0xproject/testnet-faucets`](/packages/testnet-faucets) | A faucet micro-service that dispenses test ERC20 tokens or Ether |
|
||||
| [`@0xproject/website`](/packages/website) | 0x website & Portal DApp |
|
||||
| Package | Description |
|
||||
| -------------------------------------------------------- | ---------------------------------------------------------------- |
|
||||
| [`@0x/contracts`](/packages/contracts) | 0x solidity smart contracts & tests |
|
||||
| [`@0x/react-docs-example`](/packages/react-docs-example) | Example documentation site created with `@0x/react-docs` |
|
||||
| [`@0x/testnet-faucets`](/packages/testnet-faucets) | A faucet micro-service that dispenses test ERC20 tokens or Ether |
|
||||
| [`@0x/website`](/packages/website) | 0x website & Portal DApp |
|
||||
|
||||
## Usage
|
||||
|
||||
@@ -70,10 +70,10 @@ Dedicated documentation pages:
|
||||
Node version >= 6.12 is required.
|
||||
|
||||
Most of the packages require additional typings for external dependencies.
|
||||
You can include those by prepending the `@0xproject/typescript-typings` package to your [`typeRoots`](http://www.typescriptlang.org/docs/handbook/tsconfig-json.html) config.
|
||||
You can include those by prepending the `@0x/typescript-typings` package to your [`typeRoots`](http://www.typescriptlang.org/docs/handbook/tsconfig-json.html) config.
|
||||
|
||||
```json
|
||||
"typeRoots": ["node_modules/@0xproject/typescript-typings/types", "node_modules/@types"],
|
||||
"typeRoots": ["node_modules/@0x/typescript-typings/types", "node_modules/@types"],
|
||||
```
|
||||
|
||||
## Contributing
|
||||
@@ -103,7 +103,7 @@ yarn build
|
||||
To build a specific package:
|
||||
|
||||
```bash
|
||||
PKG=@0xproject/web3-wrapper yarn build
|
||||
PKG=@0x/web3-wrapper yarn build
|
||||
```
|
||||
|
||||
### Watch
|
||||
@@ -120,7 +120,7 @@ To watch a specific package and all it's dependent packages:
|
||||
PKG=[NPM_PACKAGE_NAME] yarn watch
|
||||
|
||||
e.g
|
||||
PKG=@0xproject/web3-wrapper yarn watch
|
||||
PKG=@0x/web3-wrapper yarn watch
|
||||
```
|
||||
|
||||
### Clean
|
||||
@@ -176,5 +176,5 @@ yarn test
|
||||
Run a specific package's test:
|
||||
|
||||
```bash
|
||||
PKG=@0xproject/web3-wrapper yarn test
|
||||
PKG=@0x/web3-wrapper yarn test
|
||||
```
|
||||
|
45
package.json
45
package.json
@@ -11,10 +11,9 @@
|
||||
"ganache": "ganache-cli -p 8545 --networkId 50 -m \"${npm_package_config_mnemonic}\"",
|
||||
"prettier": "prettier --write '**/*.{ts,tsx,json,md}' --config .prettierrc",
|
||||
"prettier:ci": "prettier --list-different '**/*.{ts,tsx,json,md}' --config .prettierrc",
|
||||
"report_coverage": "lcov-result-merger 'packages/*/coverage/lcov.info' | coveralls",
|
||||
"report_coverage": "lcov-result-merger './{packages/*/coverage/lcov.info,python-packages/*/.coverage}' | coveralls",
|
||||
"test:installation": "node ./packages/monorepo-scripts/lib/test_installation.js",
|
||||
"test:installation:local": "IS_LOCAL_PUBLISH=true node ./packages/monorepo-scripts/lib/test_installation.js",
|
||||
"test:publish:circleci:comment": "HACK(albrow) We need an automated way to login to npm and echo+sleep piped to stdin was the only way I could find to do it.",
|
||||
"test:publish:circleci": "yarn npm-cli-login -u test -p test -e test@example.com -r http://localhost:4873 && IS_LOCAL_PUBLISH=true run-s script:publish test:installation:local",
|
||||
"run:publish": "run-s install:all build:monorepo_scripts script:prepublish_checks rebuild:no_website script:publish",
|
||||
"run:publish:local": "IS_LOCAL_PUBLISH=true yarn run:publish",
|
||||
@@ -24,9 +23,9 @@
|
||||
"wsrun": "wsrun",
|
||||
"lerna": "lerna",
|
||||
"build": "wsrun build $PKG --fast-exit -r --stages",
|
||||
"build:no_website": "wsrun build $PKG --fast-exit -r --stages --exclude @0xproject/website",
|
||||
"build:ci:no_website": "wsrun build:ci $PKG --fast-exit -r --stages --exclude @0xproject/website",
|
||||
"build:monorepo_scripts": "PKG=@0xproject/monorepo-scripts yarn build",
|
||||
"build:no_website": "wsrun build $PKG --fast-exit -r --stages --exclude @0x/website",
|
||||
"build:ci:no_website": "wsrun build:ci $PKG --fast-exit -r --stages --exclude @0x/website",
|
||||
"build:monorepo_scripts": "PKG=@0x/monorepo-scripts yarn build",
|
||||
"build:ts": "tsc -b",
|
||||
"watch:ts": "tsc -b -w",
|
||||
"clean": "wsrun clean $PKG --fast-exit -r --parallel",
|
||||
@@ -36,29 +35,41 @@
|
||||
"test": "wsrun test $PKG --fast-exit --serial --exclude-missing",
|
||||
"generate_doc": "node ./packages/monorepo-scripts/lib/doc_generate_and_upload.js",
|
||||
"test:generate_docs:circleci": "for i in ${npm_package_config_packagesWithDocPages}; do yarn generate_doc --package $i --shouldUpload false --isStaging true || break -1; done;",
|
||||
"bundlesize": "bundlesize",
|
||||
"bundlewatch": "bundlewatch",
|
||||
"lint": "wsrun lint $PKG --fast-exit --parallel --exclude-missing"
|
||||
},
|
||||
"config": {
|
||||
"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-cov ethereum-types"
|
||||
"packagesWithDocPages": "0x.js connect json-schemas subproviders web3-wrapper contract-wrappers order-utils order-watcher sol-compiler sol-cov ethereum-types asset-buyer"
|
||||
},
|
||||
"bundlesize": [
|
||||
{
|
||||
"path": "packages/0x.js/_bundles/index.min.js"
|
||||
},
|
||||
{
|
||||
"path": "packages/instant/public/main.bundle.js"
|
||||
"bundlewatch": {
|
||||
"files": [
|
||||
{
|
||||
"path": "packages/0x.js/_bundles/index.min.js",
|
||||
"maxSize": "700kB"
|
||||
},
|
||||
{
|
||||
"path": "packages/instant/public/main.bundle.js",
|
||||
"maxSize": "500kB"
|
||||
}
|
||||
],
|
||||
"ci": {
|
||||
"trackBranches": [
|
||||
"master",
|
||||
"development"
|
||||
],
|
||||
"repoBranchBase": "development"
|
||||
}
|
||||
],
|
||||
},
|
||||
"devDependencies": {
|
||||
"@0x-lerna-fork/lerna": "3.0.0-beta.25",
|
||||
"@0xproject/npm-cli-login": "^0.0.11",
|
||||
"async-child-process": "^1.1.1",
|
||||
"bundlesize": "^0.17.0",
|
||||
"bundlewatch": "^0.2.1",
|
||||
"coveralls": "^3.0.0",
|
||||
"ganache-cli": "6.1.3",
|
||||
"ganache-cli": "6.1.8",
|
||||
"lcov-result-merger": "^3.0.0",
|
||||
"npm-cli-login": "^0.0.10",
|
||||
"lerna": "^3.0.0-beta.25",
|
||||
"npm-run-all": "^4.1.2",
|
||||
"prettier": "^1.11.1",
|
||||
"source-map-support": "^0.5.6",
|
||||
|
@@ -1,4 +1,37 @@
|
||||
[
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Add support for `eth_signTypedData`.",
|
||||
"pr": 1102
|
||||
},
|
||||
{
|
||||
"note":
|
||||
"Added `MetamaskSubprovider` to handle inconsistencies in Metamask's signing JSON RPC endpoints.",
|
||||
"pr": 1102
|
||||
},
|
||||
{
|
||||
"note":
|
||||
"Removed `SignerType` (including `SignerType.Metamask`). Please use the `MetamaskSubprovider` to wrap `web3.currentProvider`.",
|
||||
"pr": 1102
|
||||
},
|
||||
{
|
||||
"note":
|
||||
"Updated to use new modularized artifacts and the latest version of @0xproject/contract-wrappers",
|
||||
"pr": 1105
|
||||
},
|
||||
{
|
||||
"note": "Make web3-provider-engine types a 'dependency' so it's available to users of the library",
|
||||
"pr": 1105
|
||||
},
|
||||
{
|
||||
"note": "Export new `AssetData` type from types",
|
||||
"pr": 1131
|
||||
}
|
||||
],
|
||||
"timestamp": 1539871071
|
||||
},
|
||||
{
|
||||
"version": "1.0.8",
|
||||
"changes": [
|
||||
|
@@ -5,6 +5,15 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v2.0.0 - _October 18, 2018_
|
||||
|
||||
* Add support for `eth_signTypedData`. (#1102)
|
||||
* Added `MetamaskSubprovider` to handle inconsistencies in Metamask's signing JSON RPC endpoints. (#1102)
|
||||
* Removed `SignerType` (including `SignerType.Metamask`). Please use the `MetamaskSubprovider` to wrap `web3.currentProvider`. (#1102)
|
||||
* Updated to use new modularized artifacts and the latest version of @0xproject/contract-wrappers (#1105)
|
||||
* Make web3-provider-engine types a 'dependency' so it's available to users of the library (#1105)
|
||||
* Export new `AssetData` type from types (#1131)
|
||||
|
||||
## v1.0.8 - _October 4, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
@@ -49,7 +58,7 @@ CHANGELOG
|
||||
|
||||
* Re-organize the exported interface of 0x.js. Remove the `ZeroEx` class, and instead export the same exports as `0x.js`'s sub-packages: `@0xproject/contract-wrappers`, `@0xproject/order-utils` and `@0xproject/order-watcher` (#963)
|
||||
|
||||
## v1.0.1-rc.3 - _August 13, 2018_
|
||||
## v1.0.1-rc.3 - _August 14, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
* Update ecSignOrderHashAsync to return the signature as a string for immediate use in contracts (#914)
|
||||
|
@@ -33,7 +33,7 @@ If your project is in [TypeScript](https://www.typescriptlang.org/), add the fol
|
||||
|
||||
```json
|
||||
"compilerOptions": {
|
||||
"typeRoots": ["node_modules/@0xproject/typescript-typings/types", "node_modules/@types"],
|
||||
"typeRoots": ["node_modules/@0x/typescript-typings/types", "node_modules/@types"],
|
||||
}
|
||||
```
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "0x.js",
|
||||
"version": "1.0.8",
|
||||
"version": "2.0.0",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -42,16 +42,17 @@
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"devDependencies": {
|
||||
"@0xproject/abi-gen": "^1.0.13",
|
||||
"@0xproject/dev-utils": "^1.0.12",
|
||||
"@0xproject/migrations": "^1.0.14",
|
||||
"@0xproject/monorepo-scripts": "^1.0.11",
|
||||
"@0xproject/tslint-config": "^1.0.8",
|
||||
"@0x/abi-gen": "^1.0.14",
|
||||
"@0x/abi-gen-wrappers": "^1.0.1",
|
||||
"@0x/contract-addresses": "^1.0.1",
|
||||
"@0x/dev-utils": "^1.0.13",
|
||||
"@0x/migrations": "^2.0.0",
|
||||
"@0x/monorepo-scripts": "^1.0.12",
|
||||
"@0x/tslint-config": "^1.0.9",
|
||||
"@types/lodash": "4.14.104",
|
||||
"@types/mocha": "^2.2.42",
|
||||
"@types/node": "*",
|
||||
"@types/sinon": "^2.2.2",
|
||||
"@types/web3-provider-engine": "^14.0.0",
|
||||
"awesome-typescript-loader": "^5.2.1",
|
||||
"chai": "^4.0.1",
|
||||
"chai-as-promised": "^7.1.0",
|
||||
@@ -67,24 +68,25 @@
|
||||
"sinon": "^4.0.0",
|
||||
"source-map-support": "^0.5.0",
|
||||
"tslint": "5.11.0",
|
||||
"typedoc": "0.12.0",
|
||||
"typedoc": "0.13.0",
|
||||
"typescript": "3.0.1",
|
||||
"uglifyjs-webpack-plugin": "^2.0.1",
|
||||
"webpack": "^4.20.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0xproject/assert": "^1.0.13",
|
||||
"@0xproject/base-contract": "^3.0.1",
|
||||
"@0xproject/contract-wrappers": "^2.0.2",
|
||||
"@0xproject/order-utils": "^1.0.7",
|
||||
"@0xproject/order-watcher": "^2.1.1",
|
||||
"@0xproject/subproviders": "^2.0.7",
|
||||
"@0xproject/types": "^1.1.4",
|
||||
"@0xproject/typescript-typings": "^3.0.2",
|
||||
"@0xproject/utils": "^2.0.2",
|
||||
"@0xproject/web3-wrapper": "^3.0.3",
|
||||
"ethereum-types": "^1.0.11",
|
||||
"ethers": "4.0.0-beta.14",
|
||||
"@0x/assert": "^1.0.14",
|
||||
"@0x/base-contract": "^3.0.2",
|
||||
"@0x/contract-wrappers": "^3.0.0",
|
||||
"@0x/order-utils": "^2.0.0",
|
||||
"@0x/order-watcher": "^2.2.0",
|
||||
"@0x/subproviders": "^2.1.0",
|
||||
"@0x/types": "^1.2.0",
|
||||
"@0x/typescript-typings": "^3.0.3",
|
||||
"@0x/utils": "^2.0.3",
|
||||
"@0x/web3-wrapper": "^3.1.0",
|
||||
"@types/web3-provider-engine": "^14.0.0",
|
||||
"ethereum-types": "^1.1.1",
|
||||
"ethers": "~4.0.4",
|
||||
"lodash": "^4.17.5",
|
||||
"web3-provider-engine": "14.0.6"
|
||||
},
|
||||
|
@@ -1,4 +1,6 @@
|
||||
export { assetDataUtils, signatureUtils, generatePseudoRandomSalt, orderHashUtils } from '@0xproject/order-utils';
|
||||
export { ContractAddresses } from '@0x/contract-addresses';
|
||||
|
||||
export { assetDataUtils, signatureUtils, generatePseudoRandomSalt, orderHashUtils } from '@0x/order-utils';
|
||||
|
||||
export {
|
||||
ContractWrappers,
|
||||
@@ -18,6 +20,16 @@ export {
|
||||
TransactionOpts,
|
||||
OrderStatus,
|
||||
OrderInfo,
|
||||
EventCallback,
|
||||
DecodedLogEvent,
|
||||
TransactionEncoder,
|
||||
BalanceAndAllowance,
|
||||
OrderAndTraderInfo,
|
||||
TraderInfo,
|
||||
ValidateOrderFillableOpts,
|
||||
} from '@0x/contract-wrappers';
|
||||
|
||||
export {
|
||||
WETH9Events,
|
||||
WETH9WithdrawalEventArgs,
|
||||
WETH9ApprovalEventArgs,
|
||||
@@ -38,26 +50,25 @@ export {
|
||||
ExchangeSignatureValidatorApprovalEventArgs,
|
||||
ExchangeFillEventArgs,
|
||||
ExchangeCancelEventArgs,
|
||||
ExchangeEvents,
|
||||
EventCallback,
|
||||
DecodedLogEvent,
|
||||
ExchangeEventArgs,
|
||||
TransactionEncoder,
|
||||
BalanceAndAllowance,
|
||||
OrderAndTraderInfo,
|
||||
TraderInfo,
|
||||
ValidateOrderFillableOpts,
|
||||
} from '@0xproject/contract-wrappers';
|
||||
ExchangeEvents,
|
||||
} from '@0x/abi-gen-wrappers';
|
||||
|
||||
export { OrderWatcher, OnOrderStateChangeCallback, OrderWatcherConfig } from '@0xproject/order-watcher';
|
||||
export { OrderWatcher, OnOrderStateChangeCallback, OrderWatcherConfig } from '@0x/order-watcher';
|
||||
|
||||
export import Web3ProviderEngine = require('web3-provider-engine');
|
||||
|
||||
export { RPCSubprovider, Callback, JSONRPCRequestPayloadWithMethod, ErrorCallback } from '@0xproject/subproviders';
|
||||
export {
|
||||
RPCSubprovider,
|
||||
Callback,
|
||||
JSONRPCRequestPayloadWithMethod,
|
||||
ErrorCallback,
|
||||
MetamaskSubprovider,
|
||||
} from '@0x/subproviders';
|
||||
|
||||
export { AbiDecoder } from '@0xproject/utils';
|
||||
export { AbiDecoder } from '@0x/utils';
|
||||
|
||||
export { BigNumber } from '@0xproject/utils';
|
||||
export { BigNumber } from '@0x/utils';
|
||||
|
||||
export {
|
||||
ExchangeContractErrs,
|
||||
@@ -68,12 +79,13 @@ export {
|
||||
OrderStateInvalid,
|
||||
OrderState,
|
||||
AssetProxyId,
|
||||
SignerType,
|
||||
AssetData,
|
||||
ERC20AssetData,
|
||||
ERC721AssetData,
|
||||
SignatureType,
|
||||
OrderRelevantState,
|
||||
} from '@0xproject/types';
|
||||
Stats,
|
||||
} from '@0x/types';
|
||||
|
||||
export {
|
||||
BlockParamLiteral,
|
||||
@@ -85,6 +97,7 @@ export {
|
||||
JSONRPCRequestPayload,
|
||||
JSONRPCResponsePayload,
|
||||
JSONRPCErrorCallback,
|
||||
JSONRPCResponseError,
|
||||
LogEntry,
|
||||
DecodedLogArgs,
|
||||
LogEntryEvent,
|
||||
|
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"extends": ["@0xproject/tslint-config"]
|
||||
"extends": ["@0x/tslint-config"]
|
||||
}
|
||||
|
@@ -3,5 +3,5 @@
|
||||
"compilerOptions": {
|
||||
"outDir": "lib"
|
||||
},
|
||||
"include": ["./src/**/*", "./test/**/*"]
|
||||
"include": ["./src/**/*"]
|
||||
}
|
||||
|
20
packages/abi-gen-wrappers/CHANGELOG.json
Normal file
20
packages/abi-gen-wrappers/CHANGELOG.json
Normal file
@@ -0,0 +1,20 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1539871071,
|
||||
"version": "1.0.1",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "1.0.0",
|
||||
"changes": [
|
||||
{
|
||||
"pr": 1105,
|
||||
"note": "Initial release"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
14
packages/abi-gen-wrappers/CHANGELOG.md
Normal file
14
packages/abi-gen-wrappers/CHANGELOG.md
Normal file
@@ -0,0 +1,14 @@
|
||||
<!--
|
||||
changelogUtils.file is auto-generated using the monorepo-scripts package. Don't edit directly.
|
||||
Edit the package's CHANGELOG.json file only.
|
||||
-->
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v1.0.1 - _October 18, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.0.0 - _Invalid date_
|
||||
|
||||
* Initial release (#1105)
|
73
packages/abi-gen-wrappers/README.md
Normal file
73
packages/abi-gen-wrappers/README.md
Normal file
@@ -0,0 +1,73 @@
|
||||
## @0x/abi-gen-wrappers
|
||||
|
||||
Low-level 0x smart contract wrappers generated using @0x/abi-gen. These
|
||||
low-level wrappers are imported by other packages in the 0x monorepo and
|
||||
application developers are not expected to import this package directly.
|
||||
|
||||
You may also be interested in the
|
||||
[@0x/contract-wrappers](../contract-wrappers/README.md) package which
|
||||
includes some higher-level features.
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
yarn add @0x/abi-gen-wrappers
|
||||
```
|
||||
|
||||
**Import**
|
||||
|
||||
```typescript
|
||||
import * as wrappers from '@0x/abi-gen-wrappers';
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```javascript
|
||||
var wrappers = require('@0x/abi-gen-wrappers');
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
We welcome improvements and fixes from the wider community! To report bugs within this package, please create an issue in this repository.
|
||||
|
||||
Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
|
||||
|
||||
### Install dependencies
|
||||
|
||||
If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
|
||||
|
||||
```bash
|
||||
yarn config set workspaces-experimental true
|
||||
```
|
||||
|
||||
Then install dependencies
|
||||
|
||||
```bash
|
||||
yarn install
|
||||
```
|
||||
|
||||
### Build
|
||||
|
||||
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
|
||||
|
||||
```bash
|
||||
PKG=@0x/abi-gen-wrappers yarn build
|
||||
```
|
||||
|
||||
### Clean
|
||||
|
||||
```bash
|
||||
yarn clean
|
||||
```
|
||||
|
||||
### Lint
|
||||
|
||||
```bash
|
||||
yarn lint
|
||||
```
|
||||
|
||||
### Run Tests
|
||||
|
||||
```bash
|
||||
yarn test
|
||||
```
|
48
packages/abi-gen-wrappers/package.json
Normal file
48
packages/abi-gen-wrappers/package.json
Normal file
@@ -0,0 +1,48 @@
|
||||
{
|
||||
"name": "@0x/abi-gen-wrappers",
|
||||
"version": "1.0.1",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
"description": "Low-level 0x smart contract wrappers generated using @0x/abi-gen",
|
||||
"main": "lib/src/index.js",
|
||||
"directories": {
|
||||
"test": "test"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "yarn pre_build && tsc -b",
|
||||
"build:ci": "yarn build",
|
||||
"lint": "tslint --project .",
|
||||
"pre_build": "yarn generate_contract_wrappers",
|
||||
"clean": "shx rm -rf lib wrappers",
|
||||
"generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/generated-wrappers --backend ethers"
|
||||
},
|
||||
"config": {
|
||||
"abis": "../contract-artifacts/artifacts/@(AssetProxyOwner|DummyERC20Token|DummyERC721Token|ERC20Proxy|ERC20Token|ERC721Proxy|ERC721Token|Exchange|Forwarder|IValidator|IWallet|OrderValidator|WETH9|ZRXToken).json"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/0xProject/0x-monorepo.git"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"bugs": {
|
||||
"url": "https://github.com/0xProject/0x-monorepo/issues"
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/0x-monorepo/packages/abi-gen-wrappers/README.md",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^1.0.14",
|
||||
"@0x/tslint-config": "^1.0.9",
|
||||
"@0x/utils": "^2.0.3",
|
||||
"@0x/web3-wrapper": "^3.1.0",
|
||||
"ethereum-types": "^1.1.1",
|
||||
"ethers": "~4.0.4",
|
||||
"lodash": "^4.17.5",
|
||||
"shx": "^0.2.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^3.0.2"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
649
packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts
Normal file
649
packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts
Normal file
@@ -0,0 +1,649 @@
|
||||
// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
|
||||
// tslint:disable:no-unused-variable
|
||||
// tslint:disable:no-unbound-method
|
||||
import { BaseContract } from '@0x/base-contract';
|
||||
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
|
||||
import { BigNumber, classUtils, logUtils } from '@0x/utils';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
export type ERC20ProxyEventArgs =
|
||||
| ERC20ProxyAuthorizedAddressAddedEventArgs
|
||||
| ERC20ProxyAuthorizedAddressRemovedEventArgs;
|
||||
|
||||
export enum ERC20ProxyEvents {
|
||||
AuthorizedAddressAdded = 'AuthorizedAddressAdded',
|
||||
AuthorizedAddressRemoved = 'AuthorizedAddressRemoved',
|
||||
}
|
||||
|
||||
export interface ERC20ProxyAuthorizedAddressAddedEventArgs extends DecodedLogArgs {
|
||||
target: string;
|
||||
caller: string;
|
||||
}
|
||||
|
||||
export interface ERC20ProxyAuthorizedAddressRemovedEventArgs extends DecodedLogArgs {
|
||||
target: string;
|
||||
caller: string;
|
||||
}
|
||||
|
||||
|
||||
/* istanbul ignore next */
|
||||
// tslint:disable:no-parameter-reassignment
|
||||
// tslint:disable-next-line:class-name
|
||||
export class ERC20ProxyContract extends BaseContract {
|
||||
public addAuthorizedAddress = {
|
||||
async sendTransactionAsync(
|
||||
target: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const inputAbi = self._lookupAbi('addAuthorizedAddress(address)').inputs;
|
||||
[target
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [target
|
||||
]);
|
||||
const encodedData = self._lookupEthersInterface('addAuthorizedAddress(address)').functions.addAuthorizedAddress.encode([target
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.addAuthorizedAddress.estimateGasAsync.bind(
|
||||
self,
|
||||
target
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
target: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const inputAbi = self._lookupAbi('addAuthorizedAddress(address)').inputs;
|
||||
[target
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target
|
||||
], BaseContract._bigNumberToString);
|
||||
const encodedData = self._lookupEthersInterface('addAuthorizedAddress(address)').functions.addAuthorizedAddress.encode([target
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
target: string,
|
||||
): string {
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const inputAbi = self._lookupAbi('addAuthorizedAddress(address)').inputs;
|
||||
[target
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target
|
||||
], BaseContract._bigNumberToString);
|
||||
const abiEncodedTransactionData = self._lookupEthersInterface('addAuthorizedAddress(address)').functions.addAuthorizedAddress.encode([target
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
target: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const functionSignature = 'addAuthorizedAddress(address)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[target
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [target
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.addAuthorizedAddress;
|
||||
const encodedData = ethersFunction.encode([target
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'addAuthorizedAddress'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray;
|
||||
},
|
||||
};
|
||||
public authorities = {
|
||||
async callAsync(
|
||||
index_0: BigNumber,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const functionSignature = 'authorities(uint256)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[index_0
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [index_0
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.authorities;
|
||||
const encodedData = ethersFunction.encode([index_0
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'authorities'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public removeAuthorizedAddress = {
|
||||
async sendTransactionAsync(
|
||||
target: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const inputAbi = self._lookupAbi('removeAuthorizedAddress(address)').inputs;
|
||||
[target
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [target
|
||||
]);
|
||||
const encodedData = self._lookupEthersInterface('removeAuthorizedAddress(address)').functions.removeAuthorizedAddress.encode([target
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.removeAuthorizedAddress.estimateGasAsync.bind(
|
||||
self,
|
||||
target
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
target: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const inputAbi = self._lookupAbi('removeAuthorizedAddress(address)').inputs;
|
||||
[target
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target
|
||||
], BaseContract._bigNumberToString);
|
||||
const encodedData = self._lookupEthersInterface('removeAuthorizedAddress(address)').functions.removeAuthorizedAddress.encode([target
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
target: string,
|
||||
): string {
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const inputAbi = self._lookupAbi('removeAuthorizedAddress(address)').inputs;
|
||||
[target
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target
|
||||
], BaseContract._bigNumberToString);
|
||||
const abiEncodedTransactionData = self._lookupEthersInterface('removeAuthorizedAddress(address)').functions.removeAuthorizedAddress.encode([target
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
target: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const functionSignature = 'removeAuthorizedAddress(address)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[target
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [target
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.removeAuthorizedAddress;
|
||||
const encodedData = ethersFunction.encode([target
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'removeAuthorizedAddress'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray;
|
||||
},
|
||||
};
|
||||
public owner = {
|
||||
async callAsync(
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const functionSignature = 'owner()';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, []);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.owner;
|
||||
const encodedData = ethersFunction.encode([]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'owner'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public removeAuthorizedAddressAtIndex = {
|
||||
async sendTransactionAsync(
|
||||
target: string,
|
||||
index: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const inputAbi = self._lookupAbi('removeAuthorizedAddressAtIndex(address,uint256)').inputs;
|
||||
[target,
|
||||
index
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target,
|
||||
index
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [target,
|
||||
index
|
||||
]);
|
||||
const encodedData = self._lookupEthersInterface('removeAuthorizedAddressAtIndex(address,uint256)').functions.removeAuthorizedAddressAtIndex.encode([target,
|
||||
index
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind(
|
||||
self,
|
||||
target,
|
||||
index
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
target: string,
|
||||
index: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const inputAbi = self._lookupAbi('removeAuthorizedAddressAtIndex(address,uint256)').inputs;
|
||||
[target,
|
||||
index
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target,
|
||||
index
|
||||
], BaseContract._bigNumberToString);
|
||||
const encodedData = self._lookupEthersInterface('removeAuthorizedAddressAtIndex(address,uint256)').functions.removeAuthorizedAddressAtIndex.encode([target,
|
||||
index
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
target: string,
|
||||
index: BigNumber,
|
||||
): string {
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const inputAbi = self._lookupAbi('removeAuthorizedAddressAtIndex(address,uint256)').inputs;
|
||||
[target,
|
||||
index
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target,
|
||||
index
|
||||
], BaseContract._bigNumberToString);
|
||||
const abiEncodedTransactionData = self._lookupEthersInterface('removeAuthorizedAddressAtIndex(address,uint256)').functions.removeAuthorizedAddressAtIndex.encode([target,
|
||||
index
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
target: string,
|
||||
index: BigNumber,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const functionSignature = 'removeAuthorizedAddressAtIndex(address,uint256)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[target,
|
||||
index
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target,
|
||||
index
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [target,
|
||||
index
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.removeAuthorizedAddressAtIndex;
|
||||
const encodedData = ethersFunction.encode([target,
|
||||
index
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'removeAuthorizedAddressAtIndex'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray;
|
||||
},
|
||||
};
|
||||
public getProxyId = {
|
||||
async callAsync(
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const functionSignature = 'getProxyId()';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, []);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getProxyId;
|
||||
const encodedData = ethersFunction.encode([]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'getProxyId'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public authorized = {
|
||||
async callAsync(
|
||||
index_0: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<boolean
|
||||
> {
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const functionSignature = 'authorized(address)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[index_0
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [index_0
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.authorized;
|
||||
const encodedData = ethersFunction.encode([index_0
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'authorized'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public getAuthorizedAddresses = {
|
||||
async callAsync(
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string[]
|
||||
> {
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const functionSignature = 'getAuthorizedAddresses()';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, []);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getAuthorizedAddresses;
|
||||
const encodedData = ethersFunction.encode([]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'getAuthorizedAddresses'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public transferOwnership = {
|
||||
async sendTransactionAsync(
|
||||
newOwner: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
|
||||
[newOwner
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner
|
||||
]);
|
||||
const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.transferOwnership.estimateGasAsync.bind(
|
||||
self,
|
||||
newOwner
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
newOwner: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
|
||||
[newOwner
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
|
||||
], BaseContract._bigNumberToString);
|
||||
const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
newOwner: string,
|
||||
): string {
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
|
||||
[newOwner
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
|
||||
], BaseContract._bigNumberToString);
|
||||
const abiEncodedTransactionData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
newOwner: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const functionSignature = 'transferOwnership(address)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[newOwner
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferOwnership;
|
||||
const encodedData = ethersFunction.encode([newOwner
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'transferOwnership'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray;
|
||||
},
|
||||
};
|
||||
public static async deployFrom0xArtifactAsync(
|
||||
artifact: ContractArtifact,
|
||||
provider: Provider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<ERC20ProxyContract> {
|
||||
if (_.isUndefined(artifact.compilerOutput)) {
|
||||
throw new Error('Compiler output not found in the artifact file');
|
||||
}
|
||||
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
||||
const abi = artifact.compilerOutput.abi;
|
||||
return ERC20ProxyContract.deployAsync(bytecode, abi, provider, txDefaults, );
|
||||
}
|
||||
public static async deployAsync(
|
||||
bytecode: string,
|
||||
abi: ContractAbi,
|
||||
provider: Provider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<ERC20ProxyContract> {
|
||||
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
|
||||
[] = BaseContract._formatABIDataItemList(
|
||||
constructorAbi.inputs,
|
||||
[],
|
||||
BaseContract._bigNumberToString,
|
||||
);
|
||||
const iface = new ethers.utils.Interface(abi);
|
||||
const deployInfo = iface.deployFunction;
|
||||
const txData = deployInfo.encode(bytecode, []);
|
||||
const web3Wrapper = new Web3Wrapper(provider);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{data: txData},
|
||||
txDefaults,
|
||||
web3Wrapper.estimateGasAsync.bind(web3Wrapper),
|
||||
);
|
||||
const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
logUtils.log(`transactionHash: ${txHash}`);
|
||||
const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
|
||||
logUtils.log(`ERC20Proxy successfully deployed at ${txReceipt.contractAddress}`);
|
||||
const contractInstance = new ERC20ProxyContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
|
||||
contractInstance.constructorArgs = [];
|
||||
return contractInstance;
|
||||
}
|
||||
constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
|
||||
super('ERC20Proxy', abi, address, provider, txDefaults);
|
||||
classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
|
||||
}
|
||||
} // tslint:disable:max-file-line-count
|
||||
// tslint:enable:no-unbound-method
|
556
packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts
Normal file
556
packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts
Normal file
@@ -0,0 +1,556 @@
|
||||
// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
|
||||
// tslint:disable:no-unused-variable
|
||||
// tslint:disable:no-unbound-method
|
||||
import { BaseContract } from '@0x/base-contract';
|
||||
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
|
||||
import { BigNumber, classUtils, logUtils } from '@0x/utils';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
export type ERC20TokenEventArgs =
|
||||
| ERC20TokenTransferEventArgs
|
||||
| ERC20TokenApprovalEventArgs;
|
||||
|
||||
export enum ERC20TokenEvents {
|
||||
Transfer = 'Transfer',
|
||||
Approval = 'Approval',
|
||||
}
|
||||
|
||||
export interface ERC20TokenTransferEventArgs extends DecodedLogArgs {
|
||||
_from: string;
|
||||
_to: string;
|
||||
_value: BigNumber;
|
||||
}
|
||||
|
||||
export interface ERC20TokenApprovalEventArgs extends DecodedLogArgs {
|
||||
_owner: string;
|
||||
_spender: string;
|
||||
_value: BigNumber;
|
||||
}
|
||||
|
||||
|
||||
/* istanbul ignore next */
|
||||
// tslint:disable:no-parameter-reassignment
|
||||
// tslint:disable-next-line:class-name
|
||||
export class ERC20TokenContract extends BaseContract {
|
||||
public approve = {
|
||||
async sendTransactionAsync(
|
||||
_spender: string,
|
||||
_value: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as ERC20TokenContract;
|
||||
const inputAbi = self._lookupAbi('approve(address,uint256)').inputs;
|
||||
[_spender,
|
||||
_value
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [_spender,
|
||||
_value
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [_spender,
|
||||
_value
|
||||
]);
|
||||
const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_spender,
|
||||
_value
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.approve.estimateGasAsync.bind(
|
||||
self,
|
||||
_spender,
|
||||
_value
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
_spender: string,
|
||||
_value: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as ERC20TokenContract;
|
||||
const inputAbi = self._lookupAbi('approve(address,uint256)').inputs;
|
||||
[_spender,
|
||||
_value
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [_spender,
|
||||
_value
|
||||
], BaseContract._bigNumberToString);
|
||||
const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_spender,
|
||||
_value
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
_spender: string,
|
||||
_value: BigNumber,
|
||||
): string {
|
||||
const self = this as any as ERC20TokenContract;
|
||||
const inputAbi = self._lookupAbi('approve(address,uint256)').inputs;
|
||||
[_spender,
|
||||
_value
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [_spender,
|
||||
_value
|
||||
], BaseContract._bigNumberToString);
|
||||
const abiEncodedTransactionData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_spender,
|
||||
_value
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
_spender: string,
|
||||
_value: BigNumber,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<boolean
|
||||
> {
|
||||
const self = this as any as ERC20TokenContract;
|
||||
const functionSignature = 'approve(address,uint256)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[_spender,
|
||||
_value
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [_spender,
|
||||
_value
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [_spender,
|
||||
_value
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.approve;
|
||||
const encodedData = ethersFunction.encode([_spender,
|
||||
_value
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'approve'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public totalSupply = {
|
||||
async callAsync(
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<BigNumber
|
||||
> {
|
||||
const self = this as any as ERC20TokenContract;
|
||||
const functionSignature = 'totalSupply()';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, []);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.totalSupply;
|
||||
const encodedData = ethersFunction.encode([]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'totalSupply'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public transferFrom = {
|
||||
async sendTransactionAsync(
|
||||
_from: string,
|
||||
_to: string,
|
||||
_value: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as ERC20TokenContract;
|
||||
const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs;
|
||||
[_from,
|
||||
_to,
|
||||
_value
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [_from,
|
||||
_to,
|
||||
_value
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [_from,
|
||||
_to,
|
||||
_value
|
||||
]);
|
||||
const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from,
|
||||
_to,
|
||||
_value
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.transferFrom.estimateGasAsync.bind(
|
||||
self,
|
||||
_from,
|
||||
_to,
|
||||
_value
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
_from: string,
|
||||
_to: string,
|
||||
_value: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as ERC20TokenContract;
|
||||
const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs;
|
||||
[_from,
|
||||
_to,
|
||||
_value
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [_from,
|
||||
_to,
|
||||
_value
|
||||
], BaseContract._bigNumberToString);
|
||||
const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from,
|
||||
_to,
|
||||
_value
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
_from: string,
|
||||
_to: string,
|
||||
_value: BigNumber,
|
||||
): string {
|
||||
const self = this as any as ERC20TokenContract;
|
||||
const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs;
|
||||
[_from,
|
||||
_to,
|
||||
_value
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [_from,
|
||||
_to,
|
||||
_value
|
||||
], BaseContract._bigNumberToString);
|
||||
const abiEncodedTransactionData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from,
|
||||
_to,
|
||||
_value
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
_from: string,
|
||||
_to: string,
|
||||
_value: BigNumber,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<boolean
|
||||
> {
|
||||
const self = this as any as ERC20TokenContract;
|
||||
const functionSignature = 'transferFrom(address,address,uint256)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[_from,
|
||||
_to,
|
||||
_value
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [_from,
|
||||
_to,
|
||||
_value
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [_from,
|
||||
_to,
|
||||
_value
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferFrom;
|
||||
const encodedData = ethersFunction.encode([_from,
|
||||
_to,
|
||||
_value
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'transferFrom'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public balanceOf = {
|
||||
async callAsync(
|
||||
_owner: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<BigNumber
|
||||
> {
|
||||
const self = this as any as ERC20TokenContract;
|
||||
const functionSignature = 'balanceOf(address)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[_owner
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [_owner
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [_owner
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.balanceOf;
|
||||
const encodedData = ethersFunction.encode([_owner
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'balanceOf'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public transfer = {
|
||||
async sendTransactionAsync(
|
||||
_to: string,
|
||||
_value: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as ERC20TokenContract;
|
||||
const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs;
|
||||
[_to,
|
||||
_value
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [_to,
|
||||
_value
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [_to,
|
||||
_value
|
||||
]);
|
||||
const encodedData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([_to,
|
||||
_value
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.transfer.estimateGasAsync.bind(
|
||||
self,
|
||||
_to,
|
||||
_value
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
_to: string,
|
||||
_value: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as ERC20TokenContract;
|
||||
const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs;
|
||||
[_to,
|
||||
_value
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [_to,
|
||||
_value
|
||||
], BaseContract._bigNumberToString);
|
||||
const encodedData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([_to,
|
||||
_value
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
_to: string,
|
||||
_value: BigNumber,
|
||||
): string {
|
||||
const self = this as any as ERC20TokenContract;
|
||||
const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs;
|
||||
[_to,
|
||||
_value
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [_to,
|
||||
_value
|
||||
], BaseContract._bigNumberToString);
|
||||
const abiEncodedTransactionData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([_to,
|
||||
_value
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
_to: string,
|
||||
_value: BigNumber,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<boolean
|
||||
> {
|
||||
const self = this as any as ERC20TokenContract;
|
||||
const functionSignature = 'transfer(address,uint256)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[_to,
|
||||
_value
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [_to,
|
||||
_value
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [_to,
|
||||
_value
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transfer;
|
||||
const encodedData = ethersFunction.encode([_to,
|
||||
_value
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'transfer'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public allowance = {
|
||||
async callAsync(
|
||||
_owner: string,
|
||||
_spender: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<BigNumber
|
||||
> {
|
||||
const self = this as any as ERC20TokenContract;
|
||||
const functionSignature = 'allowance(address,address)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[_owner,
|
||||
_spender
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [_owner,
|
||||
_spender
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [_owner,
|
||||
_spender
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.allowance;
|
||||
const encodedData = ethersFunction.encode([_owner,
|
||||
_spender
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'allowance'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public static async deployFrom0xArtifactAsync(
|
||||
artifact: ContractArtifact,
|
||||
provider: Provider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<ERC20TokenContract> {
|
||||
if (_.isUndefined(artifact.compilerOutput)) {
|
||||
throw new Error('Compiler output not found in the artifact file');
|
||||
}
|
||||
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
||||
const abi = artifact.compilerOutput.abi;
|
||||
return ERC20TokenContract.deployAsync(bytecode, abi, provider, txDefaults, );
|
||||
}
|
||||
public static async deployAsync(
|
||||
bytecode: string,
|
||||
abi: ContractAbi,
|
||||
provider: Provider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<ERC20TokenContract> {
|
||||
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
|
||||
[] = BaseContract._formatABIDataItemList(
|
||||
constructorAbi.inputs,
|
||||
[],
|
||||
BaseContract._bigNumberToString,
|
||||
);
|
||||
const iface = new ethers.utils.Interface(abi);
|
||||
const deployInfo = iface.deployFunction;
|
||||
const txData = deployInfo.encode(bytecode, []);
|
||||
const web3Wrapper = new Web3Wrapper(provider);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{data: txData},
|
||||
txDefaults,
|
||||
web3Wrapper.estimateGasAsync.bind(web3Wrapper),
|
||||
);
|
||||
const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
logUtils.log(`transactionHash: ${txHash}`);
|
||||
const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
|
||||
logUtils.log(`ERC20Token successfully deployed at ${txReceipt.contractAddress}`);
|
||||
const contractInstance = new ERC20TokenContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
|
||||
contractInstance.constructorArgs = [];
|
||||
return contractInstance;
|
||||
}
|
||||
constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
|
||||
super('ERC20Token', abi, address, provider, txDefaults);
|
||||
classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
|
||||
}
|
||||
} // tslint:disable:max-file-line-count
|
||||
// tslint:enable:no-unbound-method
|
649
packages/abi-gen-wrappers/src/generated-wrappers/erc721_proxy.ts
Normal file
649
packages/abi-gen-wrappers/src/generated-wrappers/erc721_proxy.ts
Normal file
@@ -0,0 +1,649 @@
|
||||
// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
|
||||
// tslint:disable:no-unused-variable
|
||||
// tslint:disable:no-unbound-method
|
||||
import { BaseContract } from '@0x/base-contract';
|
||||
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
|
||||
import { BigNumber, classUtils, logUtils } from '@0x/utils';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
export type ERC721ProxyEventArgs =
|
||||
| ERC721ProxyAuthorizedAddressAddedEventArgs
|
||||
| ERC721ProxyAuthorizedAddressRemovedEventArgs;
|
||||
|
||||
export enum ERC721ProxyEvents {
|
||||
AuthorizedAddressAdded = 'AuthorizedAddressAdded',
|
||||
AuthorizedAddressRemoved = 'AuthorizedAddressRemoved',
|
||||
}
|
||||
|
||||
export interface ERC721ProxyAuthorizedAddressAddedEventArgs extends DecodedLogArgs {
|
||||
target: string;
|
||||
caller: string;
|
||||
}
|
||||
|
||||
export interface ERC721ProxyAuthorizedAddressRemovedEventArgs extends DecodedLogArgs {
|
||||
target: string;
|
||||
caller: string;
|
||||
}
|
||||
|
||||
|
||||
/* istanbul ignore next */
|
||||
// tslint:disable:no-parameter-reassignment
|
||||
// tslint:disable-next-line:class-name
|
||||
export class ERC721ProxyContract extends BaseContract {
|
||||
public addAuthorizedAddress = {
|
||||
async sendTransactionAsync(
|
||||
target: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const inputAbi = self._lookupAbi('addAuthorizedAddress(address)').inputs;
|
||||
[target
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [target
|
||||
]);
|
||||
const encodedData = self._lookupEthersInterface('addAuthorizedAddress(address)').functions.addAuthorizedAddress.encode([target
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.addAuthorizedAddress.estimateGasAsync.bind(
|
||||
self,
|
||||
target
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
target: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const inputAbi = self._lookupAbi('addAuthorizedAddress(address)').inputs;
|
||||
[target
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target
|
||||
], BaseContract._bigNumberToString);
|
||||
const encodedData = self._lookupEthersInterface('addAuthorizedAddress(address)').functions.addAuthorizedAddress.encode([target
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
target: string,
|
||||
): string {
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const inputAbi = self._lookupAbi('addAuthorizedAddress(address)').inputs;
|
||||
[target
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target
|
||||
], BaseContract._bigNumberToString);
|
||||
const abiEncodedTransactionData = self._lookupEthersInterface('addAuthorizedAddress(address)').functions.addAuthorizedAddress.encode([target
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
target: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const functionSignature = 'addAuthorizedAddress(address)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[target
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [target
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.addAuthorizedAddress;
|
||||
const encodedData = ethersFunction.encode([target
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'addAuthorizedAddress'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray;
|
||||
},
|
||||
};
|
||||
public authorities = {
|
||||
async callAsync(
|
||||
index_0: BigNumber,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const functionSignature = 'authorities(uint256)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[index_0
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [index_0
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.authorities;
|
||||
const encodedData = ethersFunction.encode([index_0
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'authorities'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public removeAuthorizedAddress = {
|
||||
async sendTransactionAsync(
|
||||
target: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const inputAbi = self._lookupAbi('removeAuthorizedAddress(address)').inputs;
|
||||
[target
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [target
|
||||
]);
|
||||
const encodedData = self._lookupEthersInterface('removeAuthorizedAddress(address)').functions.removeAuthorizedAddress.encode([target
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.removeAuthorizedAddress.estimateGasAsync.bind(
|
||||
self,
|
||||
target
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
target: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const inputAbi = self._lookupAbi('removeAuthorizedAddress(address)').inputs;
|
||||
[target
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target
|
||||
], BaseContract._bigNumberToString);
|
||||
const encodedData = self._lookupEthersInterface('removeAuthorizedAddress(address)').functions.removeAuthorizedAddress.encode([target
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
target: string,
|
||||
): string {
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const inputAbi = self._lookupAbi('removeAuthorizedAddress(address)').inputs;
|
||||
[target
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target
|
||||
], BaseContract._bigNumberToString);
|
||||
const abiEncodedTransactionData = self._lookupEthersInterface('removeAuthorizedAddress(address)').functions.removeAuthorizedAddress.encode([target
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
target: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const functionSignature = 'removeAuthorizedAddress(address)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[target
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [target
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.removeAuthorizedAddress;
|
||||
const encodedData = ethersFunction.encode([target
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'removeAuthorizedAddress'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray;
|
||||
},
|
||||
};
|
||||
public owner = {
|
||||
async callAsync(
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const functionSignature = 'owner()';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, []);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.owner;
|
||||
const encodedData = ethersFunction.encode([]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'owner'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public removeAuthorizedAddressAtIndex = {
|
||||
async sendTransactionAsync(
|
||||
target: string,
|
||||
index: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const inputAbi = self._lookupAbi('removeAuthorizedAddressAtIndex(address,uint256)').inputs;
|
||||
[target,
|
||||
index
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target,
|
||||
index
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [target,
|
||||
index
|
||||
]);
|
||||
const encodedData = self._lookupEthersInterface('removeAuthorizedAddressAtIndex(address,uint256)').functions.removeAuthorizedAddressAtIndex.encode([target,
|
||||
index
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind(
|
||||
self,
|
||||
target,
|
||||
index
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
target: string,
|
||||
index: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const inputAbi = self._lookupAbi('removeAuthorizedAddressAtIndex(address,uint256)').inputs;
|
||||
[target,
|
||||
index
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target,
|
||||
index
|
||||
], BaseContract._bigNumberToString);
|
||||
const encodedData = self._lookupEthersInterface('removeAuthorizedAddressAtIndex(address,uint256)').functions.removeAuthorizedAddressAtIndex.encode([target,
|
||||
index
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
target: string,
|
||||
index: BigNumber,
|
||||
): string {
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const inputAbi = self._lookupAbi('removeAuthorizedAddressAtIndex(address,uint256)').inputs;
|
||||
[target,
|
||||
index
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target,
|
||||
index
|
||||
], BaseContract._bigNumberToString);
|
||||
const abiEncodedTransactionData = self._lookupEthersInterface('removeAuthorizedAddressAtIndex(address,uint256)').functions.removeAuthorizedAddressAtIndex.encode([target,
|
||||
index
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
target: string,
|
||||
index: BigNumber,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const functionSignature = 'removeAuthorizedAddressAtIndex(address,uint256)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[target,
|
||||
index
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target,
|
||||
index
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [target,
|
||||
index
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.removeAuthorizedAddressAtIndex;
|
||||
const encodedData = ethersFunction.encode([target,
|
||||
index
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'removeAuthorizedAddressAtIndex'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray;
|
||||
},
|
||||
};
|
||||
public getProxyId = {
|
||||
async callAsync(
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const functionSignature = 'getProxyId()';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, []);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getProxyId;
|
||||
const encodedData = ethersFunction.encode([]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'getProxyId'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public authorized = {
|
||||
async callAsync(
|
||||
index_0: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<boolean
|
||||
> {
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const functionSignature = 'authorized(address)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[index_0
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [index_0
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.authorized;
|
||||
const encodedData = ethersFunction.encode([index_0
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'authorized'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public getAuthorizedAddresses = {
|
||||
async callAsync(
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string[]
|
||||
> {
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const functionSignature = 'getAuthorizedAddresses()';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, []);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getAuthorizedAddresses;
|
||||
const encodedData = ethersFunction.encode([]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'getAuthorizedAddresses'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public transferOwnership = {
|
||||
async sendTransactionAsync(
|
||||
newOwner: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
|
||||
[newOwner
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner
|
||||
]);
|
||||
const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.transferOwnership.estimateGasAsync.bind(
|
||||
self,
|
||||
newOwner
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
newOwner: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
|
||||
[newOwner
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
|
||||
], BaseContract._bigNumberToString);
|
||||
const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
newOwner: string,
|
||||
): string {
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
|
||||
[newOwner
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
|
||||
], BaseContract._bigNumberToString);
|
||||
const abiEncodedTransactionData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
newOwner: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const functionSignature = 'transferOwnership(address)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[newOwner
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferOwnership;
|
||||
const encodedData = ethersFunction.encode([newOwner
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'transferOwnership'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray;
|
||||
},
|
||||
};
|
||||
public static async deployFrom0xArtifactAsync(
|
||||
artifact: ContractArtifact,
|
||||
provider: Provider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<ERC721ProxyContract> {
|
||||
if (_.isUndefined(artifact.compilerOutput)) {
|
||||
throw new Error('Compiler output not found in the artifact file');
|
||||
}
|
||||
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
||||
const abi = artifact.compilerOutput.abi;
|
||||
return ERC721ProxyContract.deployAsync(bytecode, abi, provider, txDefaults, );
|
||||
}
|
||||
public static async deployAsync(
|
||||
bytecode: string,
|
||||
abi: ContractAbi,
|
||||
provider: Provider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<ERC721ProxyContract> {
|
||||
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
|
||||
[] = BaseContract._formatABIDataItemList(
|
||||
constructorAbi.inputs,
|
||||
[],
|
||||
BaseContract._bigNumberToString,
|
||||
);
|
||||
const iface = new ethers.utils.Interface(abi);
|
||||
const deployInfo = iface.deployFunction;
|
||||
const txData = deployInfo.encode(bytecode, []);
|
||||
const web3Wrapper = new Web3Wrapper(provider);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{data: txData},
|
||||
txDefaults,
|
||||
web3Wrapper.estimateGasAsync.bind(web3Wrapper),
|
||||
);
|
||||
const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
logUtils.log(`transactionHash: ${txHash}`);
|
||||
const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
|
||||
logUtils.log(`ERC721Proxy successfully deployed at ${txReceipt.contractAddress}`);
|
||||
const contractInstance = new ERC721ProxyContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
|
||||
contractInstance.constructorArgs = [];
|
||||
return contractInstance;
|
||||
}
|
||||
constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
|
||||
super('ERC721Proxy', abi, address, provider, txDefaults);
|
||||
classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
|
||||
}
|
||||
} // tslint:disable:max-file-line-count
|
||||
// tslint:enable:no-unbound-method
|
893
packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts
Normal file
893
packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts
Normal file
@@ -0,0 +1,893 @@
|
||||
// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
|
||||
// tslint:disable:no-unused-variable
|
||||
// tslint:disable:no-unbound-method
|
||||
import { BaseContract } from '@0x/base-contract';
|
||||
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
|
||||
import { BigNumber, classUtils, logUtils } from '@0x/utils';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
export type ERC721TokenEventArgs =
|
||||
| ERC721TokenTransferEventArgs
|
||||
| ERC721TokenApprovalEventArgs
|
||||
| ERC721TokenApprovalForAllEventArgs;
|
||||
|
||||
export enum ERC721TokenEvents {
|
||||
Transfer = 'Transfer',
|
||||
Approval = 'Approval',
|
||||
ApprovalForAll = 'ApprovalForAll',
|
||||
}
|
||||
|
||||
export interface ERC721TokenTransferEventArgs extends DecodedLogArgs {
|
||||
_from: string;
|
||||
_to: string;
|
||||
_tokenId: BigNumber;
|
||||
}
|
||||
|
||||
export interface ERC721TokenApprovalEventArgs extends DecodedLogArgs {
|
||||
_owner: string;
|
||||
_approved: string;
|
||||
_tokenId: BigNumber;
|
||||
}
|
||||
|
||||
export interface ERC721TokenApprovalForAllEventArgs extends DecodedLogArgs {
|
||||
_owner: string;
|
||||
_operator: string;
|
||||
_approved: boolean;
|
||||
}
|
||||
|
||||
|
||||
/* istanbul ignore next */
|
||||
// tslint:disable:no-parameter-reassignment
|
||||
// tslint:disable-next-line:class-name
|
||||
export class ERC721TokenContract extends BaseContract {
|
||||
public getApproved = {
|
||||
async callAsync(
|
||||
_tokenId: BigNumber,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const functionSignature = 'getApproved(uint256)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[_tokenId
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [_tokenId
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [_tokenId
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getApproved;
|
||||
const encodedData = ethersFunction.encode([_tokenId
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'getApproved'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public approve = {
|
||||
async sendTransactionAsync(
|
||||
_approved: string,
|
||||
_tokenId: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const inputAbi = self._lookupAbi('approve(address,uint256)').inputs;
|
||||
[_approved,
|
||||
_tokenId
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [_approved,
|
||||
_tokenId
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [_approved,
|
||||
_tokenId
|
||||
]);
|
||||
const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_approved,
|
||||
_tokenId
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.approve.estimateGasAsync.bind(
|
||||
self,
|
||||
_approved,
|
||||
_tokenId
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
_approved: string,
|
||||
_tokenId: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const inputAbi = self._lookupAbi('approve(address,uint256)').inputs;
|
||||
[_approved,
|
||||
_tokenId
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [_approved,
|
||||
_tokenId
|
||||
], BaseContract._bigNumberToString);
|
||||
const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_approved,
|
||||
_tokenId
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
_approved: string,
|
||||
_tokenId: BigNumber,
|
||||
): string {
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const inputAbi = self._lookupAbi('approve(address,uint256)').inputs;
|
||||
[_approved,
|
||||
_tokenId
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [_approved,
|
||||
_tokenId
|
||||
], BaseContract._bigNumberToString);
|
||||
const abiEncodedTransactionData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_approved,
|
||||
_tokenId
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
_approved: string,
|
||||
_tokenId: BigNumber,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const functionSignature = 'approve(address,uint256)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[_approved,
|
||||
_tokenId
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [_approved,
|
||||
_tokenId
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [_approved,
|
||||
_tokenId
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.approve;
|
||||
const encodedData = ethersFunction.encode([_approved,
|
||||
_tokenId
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'approve'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray;
|
||||
},
|
||||
};
|
||||
public transferFrom = {
|
||||
async sendTransactionAsync(
|
||||
_from: string,
|
||||
_to: string,
|
||||
_tokenId: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs;
|
||||
[_from,
|
||||
_to,
|
||||
_tokenId
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [_from,
|
||||
_to,
|
||||
_tokenId
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [_from,
|
||||
_to,
|
||||
_tokenId
|
||||
]);
|
||||
const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from,
|
||||
_to,
|
||||
_tokenId
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.transferFrom.estimateGasAsync.bind(
|
||||
self,
|
||||
_from,
|
||||
_to,
|
||||
_tokenId
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
_from: string,
|
||||
_to: string,
|
||||
_tokenId: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs;
|
||||
[_from,
|
||||
_to,
|
||||
_tokenId
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [_from,
|
||||
_to,
|
||||
_tokenId
|
||||
], BaseContract._bigNumberToString);
|
||||
const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from,
|
||||
_to,
|
||||
_tokenId
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
_from: string,
|
||||
_to: string,
|
||||
_tokenId: BigNumber,
|
||||
): string {
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs;
|
||||
[_from,
|
||||
_to,
|
||||
_tokenId
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [_from,
|
||||
_to,
|
||||
_tokenId
|
||||
], BaseContract._bigNumberToString);
|
||||
const abiEncodedTransactionData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from,
|
||||
_to,
|
||||
_tokenId
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
_from: string,
|
||||
_to: string,
|
||||
_tokenId: BigNumber,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const functionSignature = 'transferFrom(address,address,uint256)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[_from,
|
||||
_to,
|
||||
_tokenId
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [_from,
|
||||
_to,
|
||||
_tokenId
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [_from,
|
||||
_to,
|
||||
_tokenId
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferFrom;
|
||||
const encodedData = ethersFunction.encode([_from,
|
||||
_to,
|
||||
_tokenId
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'transferFrom'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray;
|
||||
},
|
||||
};
|
||||
public safeTransferFrom1 = {
|
||||
async sendTransactionAsync(
|
||||
_from: string,
|
||||
_to: string,
|
||||
_tokenId: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const inputAbi = self._lookupAbi('safeTransferFrom(address,address,uint256)').inputs;
|
||||
[_from,
|
||||
_to,
|
||||
_tokenId
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [_from,
|
||||
_to,
|
||||
_tokenId
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [_from,
|
||||
_to,
|
||||
_tokenId
|
||||
]);
|
||||
const encodedData = self._lookupEthersInterface('safeTransferFrom(address,address,uint256)').functions.safeTransferFrom.encode([_from,
|
||||
_to,
|
||||
_tokenId
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.safeTransferFrom1.estimateGasAsync.bind(
|
||||
self,
|
||||
_from,
|
||||
_to,
|
||||
_tokenId
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
_from: string,
|
||||
_to: string,
|
||||
_tokenId: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const inputAbi = self._lookupAbi('safeTransferFrom(address,address,uint256)').inputs;
|
||||
[_from,
|
||||
_to,
|
||||
_tokenId
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [_from,
|
||||
_to,
|
||||
_tokenId
|
||||
], BaseContract._bigNumberToString);
|
||||
const encodedData = self._lookupEthersInterface('safeTransferFrom(address,address,uint256)').functions.safeTransferFrom.encode([_from,
|
||||
_to,
|
||||
_tokenId
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
_from: string,
|
||||
_to: string,
|
||||
_tokenId: BigNumber,
|
||||
): string {
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const inputAbi = self._lookupAbi('safeTransferFrom(address,address,uint256)').inputs;
|
||||
[_from,
|
||||
_to,
|
||||
_tokenId
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [_from,
|
||||
_to,
|
||||
_tokenId
|
||||
], BaseContract._bigNumberToString);
|
||||
const abiEncodedTransactionData = self._lookupEthersInterface('safeTransferFrom(address,address,uint256)').functions.safeTransferFrom.encode([_from,
|
||||
_to,
|
||||
_tokenId
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
_from: string,
|
||||
_to: string,
|
||||
_tokenId: BigNumber,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const functionSignature = 'safeTransferFrom(address,address,uint256)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[_from,
|
||||
_to,
|
||||
_tokenId
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [_from,
|
||||
_to,
|
||||
_tokenId
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [_from,
|
||||
_to,
|
||||
_tokenId
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.safeTransferFrom;
|
||||
const encodedData = ethersFunction.encode([_from,
|
||||
_to,
|
||||
_tokenId
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'safeTransferFrom'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray;
|
||||
},
|
||||
};
|
||||
public ownerOf = {
|
||||
async callAsync(
|
||||
_tokenId: BigNumber,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const functionSignature = 'ownerOf(uint256)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[_tokenId
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [_tokenId
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [_tokenId
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.ownerOf;
|
||||
const encodedData = ethersFunction.encode([_tokenId
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'ownerOf'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public balanceOf = {
|
||||
async callAsync(
|
||||
_owner: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<BigNumber
|
||||
> {
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const functionSignature = 'balanceOf(address)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[_owner
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [_owner
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [_owner
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.balanceOf;
|
||||
const encodedData = ethersFunction.encode([_owner
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'balanceOf'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public setApprovalForAll = {
|
||||
async sendTransactionAsync(
|
||||
_operator: string,
|
||||
_approved: boolean,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const inputAbi = self._lookupAbi('setApprovalForAll(address,bool)').inputs;
|
||||
[_operator,
|
||||
_approved
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [_operator,
|
||||
_approved
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [_operator,
|
||||
_approved
|
||||
]);
|
||||
const encodedData = self._lookupEthersInterface('setApprovalForAll(address,bool)').functions.setApprovalForAll.encode([_operator,
|
||||
_approved
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.setApprovalForAll.estimateGasAsync.bind(
|
||||
self,
|
||||
_operator,
|
||||
_approved
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
_operator: string,
|
||||
_approved: boolean,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const inputAbi = self._lookupAbi('setApprovalForAll(address,bool)').inputs;
|
||||
[_operator,
|
||||
_approved
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [_operator,
|
||||
_approved
|
||||
], BaseContract._bigNumberToString);
|
||||
const encodedData = self._lookupEthersInterface('setApprovalForAll(address,bool)').functions.setApprovalForAll.encode([_operator,
|
||||
_approved
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
_operator: string,
|
||||
_approved: boolean,
|
||||
): string {
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const inputAbi = self._lookupAbi('setApprovalForAll(address,bool)').inputs;
|
||||
[_operator,
|
||||
_approved
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [_operator,
|
||||
_approved
|
||||
], BaseContract._bigNumberToString);
|
||||
const abiEncodedTransactionData = self._lookupEthersInterface('setApprovalForAll(address,bool)').functions.setApprovalForAll.encode([_operator,
|
||||
_approved
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
_operator: string,
|
||||
_approved: boolean,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const functionSignature = 'setApprovalForAll(address,bool)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[_operator,
|
||||
_approved
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [_operator,
|
||||
_approved
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [_operator,
|
||||
_approved
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.setApprovalForAll;
|
||||
const encodedData = ethersFunction.encode([_operator,
|
||||
_approved
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'setApprovalForAll'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray;
|
||||
},
|
||||
};
|
||||
public safeTransferFrom2 = {
|
||||
async sendTransactionAsync(
|
||||
_from: string,
|
||||
_to: string,
|
||||
_tokenId: BigNumber,
|
||||
_data: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const inputAbi = self._lookupAbi('safeTransferFrom(address,address,uint256,bytes)').inputs;
|
||||
[_from,
|
||||
_to,
|
||||
_tokenId,
|
||||
_data
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [_from,
|
||||
_to,
|
||||
_tokenId,
|
||||
_data
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [_from,
|
||||
_to,
|
||||
_tokenId,
|
||||
_data
|
||||
]);
|
||||
const encodedData = self._lookupEthersInterface('safeTransferFrom(address,address,uint256,bytes)').functions.safeTransferFrom.encode([_from,
|
||||
_to,
|
||||
_tokenId,
|
||||
_data
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.safeTransferFrom2.estimateGasAsync.bind(
|
||||
self,
|
||||
_from,
|
||||
_to,
|
||||
_tokenId,
|
||||
_data
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
_from: string,
|
||||
_to: string,
|
||||
_tokenId: BigNumber,
|
||||
_data: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const inputAbi = self._lookupAbi('safeTransferFrom(address,address,uint256,bytes)').inputs;
|
||||
[_from,
|
||||
_to,
|
||||
_tokenId,
|
||||
_data
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [_from,
|
||||
_to,
|
||||
_tokenId,
|
||||
_data
|
||||
], BaseContract._bigNumberToString);
|
||||
const encodedData = self._lookupEthersInterface('safeTransferFrom(address,address,uint256,bytes)').functions.safeTransferFrom.encode([_from,
|
||||
_to,
|
||||
_tokenId,
|
||||
_data
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
_from: string,
|
||||
_to: string,
|
||||
_tokenId: BigNumber,
|
||||
_data: string,
|
||||
): string {
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const inputAbi = self._lookupAbi('safeTransferFrom(address,address,uint256,bytes)').inputs;
|
||||
[_from,
|
||||
_to,
|
||||
_tokenId,
|
||||
_data
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [_from,
|
||||
_to,
|
||||
_tokenId,
|
||||
_data
|
||||
], BaseContract._bigNumberToString);
|
||||
const abiEncodedTransactionData = self._lookupEthersInterface('safeTransferFrom(address,address,uint256,bytes)').functions.safeTransferFrom.encode([_from,
|
||||
_to,
|
||||
_tokenId,
|
||||
_data
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
_from: string,
|
||||
_to: string,
|
||||
_tokenId: BigNumber,
|
||||
_data: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const functionSignature = 'safeTransferFrom(address,address,uint256,bytes)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[_from,
|
||||
_to,
|
||||
_tokenId,
|
||||
_data
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [_from,
|
||||
_to,
|
||||
_tokenId,
|
||||
_data
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [_from,
|
||||
_to,
|
||||
_tokenId,
|
||||
_data
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.safeTransferFrom;
|
||||
const encodedData = ethersFunction.encode([_from,
|
||||
_to,
|
||||
_tokenId,
|
||||
_data
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'safeTransferFrom'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray;
|
||||
},
|
||||
};
|
||||
public isApprovedForAll = {
|
||||
async callAsync(
|
||||
_owner: string,
|
||||
_operator: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<boolean
|
||||
> {
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const functionSignature = 'isApprovedForAll(address,address)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[_owner,
|
||||
_operator
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [_owner,
|
||||
_operator
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [_owner,
|
||||
_operator
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.isApprovedForAll;
|
||||
const encodedData = ethersFunction.encode([_owner,
|
||||
_operator
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'isApprovedForAll'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public static async deployFrom0xArtifactAsync(
|
||||
artifact: ContractArtifact,
|
||||
provider: Provider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<ERC721TokenContract> {
|
||||
if (_.isUndefined(artifact.compilerOutput)) {
|
||||
throw new Error('Compiler output not found in the artifact file');
|
||||
}
|
||||
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
||||
const abi = artifact.compilerOutput.abi;
|
||||
return ERC721TokenContract.deployAsync(bytecode, abi, provider, txDefaults, );
|
||||
}
|
||||
public static async deployAsync(
|
||||
bytecode: string,
|
||||
abi: ContractAbi,
|
||||
provider: Provider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<ERC721TokenContract> {
|
||||
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
|
||||
[] = BaseContract._formatABIDataItemList(
|
||||
constructorAbi.inputs,
|
||||
[],
|
||||
BaseContract._bigNumberToString,
|
||||
);
|
||||
const iface = new ethers.utils.Interface(abi);
|
||||
const deployInfo = iface.deployFunction;
|
||||
const txData = deployInfo.encode(bytecode, []);
|
||||
const web3Wrapper = new Web3Wrapper(provider);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{data: txData},
|
||||
txDefaults,
|
||||
web3Wrapper.estimateGasAsync.bind(web3Wrapper),
|
||||
);
|
||||
const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
logUtils.log(`transactionHash: ${txHash}`);
|
||||
const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
|
||||
logUtils.log(`ERC721Token successfully deployed at ${txReceipt.contractAddress}`);
|
||||
const contractInstance = new ERC721TokenContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
|
||||
contractInstance.constructorArgs = [];
|
||||
return contractInstance;
|
||||
}
|
||||
constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
|
||||
super('ERC721Token', abi, address, provider, txDefaults);
|
||||
classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
|
||||
}
|
||||
} // tslint:disable:max-file-line-count
|
||||
// tslint:enable:no-unbound-method
|
3072
packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts
Normal file
3072
packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts
Normal file
File diff suppressed because it is too large
Load Diff
730
packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts
Normal file
730
packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts
Normal file
@@ -0,0 +1,730 @@
|
||||
// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
|
||||
// tslint:disable:no-unused-variable
|
||||
// tslint:disable:no-unbound-method
|
||||
import { BaseContract } from '@0x/base-contract';
|
||||
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
|
||||
import { BigNumber, classUtils, logUtils } from '@0x/utils';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
|
||||
/* istanbul ignore next */
|
||||
// tslint:disable:no-parameter-reassignment
|
||||
// tslint:disable-next-line:class-name
|
||||
export class ForwarderContract extends BaseContract {
|
||||
public marketBuyOrdersWithEth = {
|
||||
async sendTransactionAsync(
|
||||
orders: 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}>,
|
||||
makerAssetFillAmount: BigNumber,
|
||||
signatures: string[],
|
||||
feeOrders: 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}>,
|
||||
feeSignatures: string[],
|
||||
feePercentage: BigNumber,
|
||||
feeRecipient: string,
|
||||
txData: Partial<TxDataPayable> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as ForwarderContract;
|
||||
const inputAbi = self._lookupAbi('marketBuyOrdersWithEth(tuple[],uint256,bytes[],tuple[],bytes[],uint256,address)').inputs;
|
||||
[orders,
|
||||
makerAssetFillAmount,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [orders,
|
||||
makerAssetFillAmount,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [orders,
|
||||
makerAssetFillAmount,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
]);
|
||||
const encodedData = self._lookupEthersInterface('marketBuyOrdersWithEth(tuple[],uint256,bytes[],tuple[],bytes[],uint256,address)').functions.marketBuyOrdersWithEth.encode([orders,
|
||||
makerAssetFillAmount,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.marketBuyOrdersWithEth.estimateGasAsync.bind(
|
||||
self,
|
||||
orders,
|
||||
makerAssetFillAmount,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
orders: 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}>,
|
||||
makerAssetFillAmount: BigNumber,
|
||||
signatures: string[],
|
||||
feeOrders: 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}>,
|
||||
feeSignatures: string[],
|
||||
feePercentage: BigNumber,
|
||||
feeRecipient: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as ForwarderContract;
|
||||
const inputAbi = self._lookupAbi('marketBuyOrdersWithEth(tuple[],uint256,bytes[],tuple[],bytes[],uint256,address)').inputs;
|
||||
[orders,
|
||||
makerAssetFillAmount,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [orders,
|
||||
makerAssetFillAmount,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
], BaseContract._bigNumberToString);
|
||||
const encodedData = self._lookupEthersInterface('marketBuyOrdersWithEth(tuple[],uint256,bytes[],tuple[],bytes[],uint256,address)').functions.marketBuyOrdersWithEth.encode([orders,
|
||||
makerAssetFillAmount,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
orders: 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}>,
|
||||
makerAssetFillAmount: BigNumber,
|
||||
signatures: string[],
|
||||
feeOrders: 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}>,
|
||||
feeSignatures: string[],
|
||||
feePercentage: BigNumber,
|
||||
feeRecipient: string,
|
||||
): string {
|
||||
const self = this as any as ForwarderContract;
|
||||
const inputAbi = self._lookupAbi('marketBuyOrdersWithEth(tuple[],uint256,bytes[],tuple[],bytes[],uint256,address)').inputs;
|
||||
[orders,
|
||||
makerAssetFillAmount,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [orders,
|
||||
makerAssetFillAmount,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
], BaseContract._bigNumberToString);
|
||||
const abiEncodedTransactionData = self._lookupEthersInterface('marketBuyOrdersWithEth(tuple[],uint256,bytes[],tuple[],bytes[],uint256,address)').functions.marketBuyOrdersWithEth.encode([orders,
|
||||
makerAssetFillAmount,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
orders: 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}>,
|
||||
makerAssetFillAmount: BigNumber,
|
||||
signatures: string[],
|
||||
feeOrders: 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}>,
|
||||
feeSignatures: string[],
|
||||
feePercentage: BigNumber,
|
||||
feeRecipient: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<[{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}, {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}]
|
||||
> {
|
||||
const self = this as any as ForwarderContract;
|
||||
const functionSignature = 'marketBuyOrdersWithEth(tuple[],uint256,bytes[],tuple[],bytes[],uint256,address)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[orders,
|
||||
makerAssetFillAmount,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [orders,
|
||||
makerAssetFillAmount,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [orders,
|
||||
makerAssetFillAmount,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.marketBuyOrdersWithEth;
|
||||
const encodedData = ethersFunction.encode([orders,
|
||||
makerAssetFillAmount,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'marketBuyOrdersWithEth'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray;
|
||||
},
|
||||
};
|
||||
public withdrawAsset = {
|
||||
async sendTransactionAsync(
|
||||
assetData: string,
|
||||
amount: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as ForwarderContract;
|
||||
const inputAbi = self._lookupAbi('withdrawAsset(bytes,uint256)').inputs;
|
||||
[assetData,
|
||||
amount
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [assetData,
|
||||
amount
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [assetData,
|
||||
amount
|
||||
]);
|
||||
const encodedData = self._lookupEthersInterface('withdrawAsset(bytes,uint256)').functions.withdrawAsset.encode([assetData,
|
||||
amount
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.withdrawAsset.estimateGasAsync.bind(
|
||||
self,
|
||||
assetData,
|
||||
amount
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
assetData: string,
|
||||
amount: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as ForwarderContract;
|
||||
const inputAbi = self._lookupAbi('withdrawAsset(bytes,uint256)').inputs;
|
||||
[assetData,
|
||||
amount
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [assetData,
|
||||
amount
|
||||
], BaseContract._bigNumberToString);
|
||||
const encodedData = self._lookupEthersInterface('withdrawAsset(bytes,uint256)').functions.withdrawAsset.encode([assetData,
|
||||
amount
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
assetData: string,
|
||||
amount: BigNumber,
|
||||
): string {
|
||||
const self = this as any as ForwarderContract;
|
||||
const inputAbi = self._lookupAbi('withdrawAsset(bytes,uint256)').inputs;
|
||||
[assetData,
|
||||
amount
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [assetData,
|
||||
amount
|
||||
], BaseContract._bigNumberToString);
|
||||
const abiEncodedTransactionData = self._lookupEthersInterface('withdrawAsset(bytes,uint256)').functions.withdrawAsset.encode([assetData,
|
||||
amount
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
assetData: string,
|
||||
amount: BigNumber,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
const self = this as any as ForwarderContract;
|
||||
const functionSignature = 'withdrawAsset(bytes,uint256)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[assetData,
|
||||
amount
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [assetData,
|
||||
amount
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [assetData,
|
||||
amount
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.withdrawAsset;
|
||||
const encodedData = ethersFunction.encode([assetData,
|
||||
amount
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'withdrawAsset'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray;
|
||||
},
|
||||
};
|
||||
public owner = {
|
||||
async callAsync(
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
const self = this as any as ForwarderContract;
|
||||
const functionSignature = 'owner()';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, []);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.owner;
|
||||
const encodedData = ethersFunction.encode([]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'owner'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public marketSellOrdersWithEth = {
|
||||
async sendTransactionAsync(
|
||||
orders: 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}>,
|
||||
signatures: string[],
|
||||
feeOrders: 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}>,
|
||||
feeSignatures: string[],
|
||||
feePercentage: BigNumber,
|
||||
feeRecipient: string,
|
||||
txData: Partial<TxDataPayable> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as ForwarderContract;
|
||||
const inputAbi = self._lookupAbi('marketSellOrdersWithEth(tuple[],bytes[],tuple[],bytes[],uint256,address)').inputs;
|
||||
[orders,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [orders,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [orders,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
]);
|
||||
const encodedData = self._lookupEthersInterface('marketSellOrdersWithEth(tuple[],bytes[],tuple[],bytes[],uint256,address)').functions.marketSellOrdersWithEth.encode([orders,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.marketSellOrdersWithEth.estimateGasAsync.bind(
|
||||
self,
|
||||
orders,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
orders: 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}>,
|
||||
signatures: string[],
|
||||
feeOrders: 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}>,
|
||||
feeSignatures: string[],
|
||||
feePercentage: BigNumber,
|
||||
feeRecipient: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as ForwarderContract;
|
||||
const inputAbi = self._lookupAbi('marketSellOrdersWithEth(tuple[],bytes[],tuple[],bytes[],uint256,address)').inputs;
|
||||
[orders,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [orders,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
], BaseContract._bigNumberToString);
|
||||
const encodedData = self._lookupEthersInterface('marketSellOrdersWithEth(tuple[],bytes[],tuple[],bytes[],uint256,address)').functions.marketSellOrdersWithEth.encode([orders,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
orders: 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}>,
|
||||
signatures: string[],
|
||||
feeOrders: 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}>,
|
||||
feeSignatures: string[],
|
||||
feePercentage: BigNumber,
|
||||
feeRecipient: string,
|
||||
): string {
|
||||
const self = this as any as ForwarderContract;
|
||||
const inputAbi = self._lookupAbi('marketSellOrdersWithEth(tuple[],bytes[],tuple[],bytes[],uint256,address)').inputs;
|
||||
[orders,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [orders,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
], BaseContract._bigNumberToString);
|
||||
const abiEncodedTransactionData = self._lookupEthersInterface('marketSellOrdersWithEth(tuple[],bytes[],tuple[],bytes[],uint256,address)').functions.marketSellOrdersWithEth.encode([orders,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
orders: 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}>,
|
||||
signatures: string[],
|
||||
feeOrders: 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}>,
|
||||
feeSignatures: string[],
|
||||
feePercentage: BigNumber,
|
||||
feeRecipient: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<[{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}, {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}]
|
||||
> {
|
||||
const self = this as any as ForwarderContract;
|
||||
const functionSignature = 'marketSellOrdersWithEth(tuple[],bytes[],tuple[],bytes[],uint256,address)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[orders,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [orders,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [orders,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.marketSellOrdersWithEth;
|
||||
const encodedData = ethersFunction.encode([orders,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'marketSellOrdersWithEth'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray;
|
||||
},
|
||||
};
|
||||
public transferOwnership = {
|
||||
async sendTransactionAsync(
|
||||
newOwner: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as ForwarderContract;
|
||||
const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
|
||||
[newOwner
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner
|
||||
]);
|
||||
const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.transferOwnership.estimateGasAsync.bind(
|
||||
self,
|
||||
newOwner
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
newOwner: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as ForwarderContract;
|
||||
const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
|
||||
[newOwner
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
|
||||
], BaseContract._bigNumberToString);
|
||||
const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
newOwner: string,
|
||||
): string {
|
||||
const self = this as any as ForwarderContract;
|
||||
const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
|
||||
[newOwner
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
|
||||
], BaseContract._bigNumberToString);
|
||||
const abiEncodedTransactionData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
newOwner: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
const self = this as any as ForwarderContract;
|
||||
const functionSignature = 'transferOwnership(address)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[newOwner
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferOwnership;
|
||||
const encodedData = ethersFunction.encode([newOwner
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'transferOwnership'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray;
|
||||
},
|
||||
};
|
||||
public static async deployFrom0xArtifactAsync(
|
||||
artifact: ContractArtifact,
|
||||
provider: Provider,
|
||||
txDefaults: Partial<TxData>,
|
||||
_exchange: string,
|
||||
_zrxAssetData: string,
|
||||
_wethAssetData: string,
|
||||
): Promise<ForwarderContract> {
|
||||
if (_.isUndefined(artifact.compilerOutput)) {
|
||||
throw new Error('Compiler output not found in the artifact file');
|
||||
}
|
||||
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
||||
const abi = artifact.compilerOutput.abi;
|
||||
return ForwarderContract.deployAsync(bytecode, abi, provider, txDefaults, _exchange,
|
||||
_zrxAssetData,
|
||||
_wethAssetData
|
||||
);
|
||||
}
|
||||
public static async deployAsync(
|
||||
bytecode: string,
|
||||
abi: ContractAbi,
|
||||
provider: Provider,
|
||||
txDefaults: Partial<TxData>,
|
||||
_exchange: string,
|
||||
_zrxAssetData: string,
|
||||
_wethAssetData: string,
|
||||
): Promise<ForwarderContract> {
|
||||
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
|
||||
[_exchange,
|
||||
_zrxAssetData,
|
||||
_wethAssetData
|
||||
] = BaseContract._formatABIDataItemList(
|
||||
constructorAbi.inputs,
|
||||
[_exchange,
|
||||
_zrxAssetData,
|
||||
_wethAssetData
|
||||
],
|
||||
BaseContract._bigNumberToString,
|
||||
);
|
||||
const iface = new ethers.utils.Interface(abi);
|
||||
const deployInfo = iface.deployFunction;
|
||||
const txData = deployInfo.encode(bytecode, [_exchange,
|
||||
_zrxAssetData,
|
||||
_wethAssetData
|
||||
]);
|
||||
const web3Wrapper = new Web3Wrapper(provider);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{data: txData},
|
||||
txDefaults,
|
||||
web3Wrapper.estimateGasAsync.bind(web3Wrapper),
|
||||
);
|
||||
const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
logUtils.log(`transactionHash: ${txHash}`);
|
||||
const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
|
||||
logUtils.log(`Forwarder successfully deployed at ${txReceipt.contractAddress}`);
|
||||
const contractInstance = new ForwarderContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
|
||||
contractInstance.constructorArgs = [_exchange,
|
||||
_zrxAssetData,
|
||||
_wethAssetData
|
||||
];
|
||||
return contractInstance;
|
||||
}
|
||||
constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
|
||||
super('Forwarder', abi, address, provider, txDefaults);
|
||||
classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
|
||||
}
|
||||
} // tslint:disable:max-file-line-count
|
||||
// tslint:enable:no-unbound-method
|
108
packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts
Normal file
108
packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts
Normal file
@@ -0,0 +1,108 @@
|
||||
// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
|
||||
// tslint:disable:no-unused-variable
|
||||
// tslint:disable:no-unbound-method
|
||||
import { BaseContract } from '@0x/base-contract';
|
||||
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
|
||||
import { BigNumber, classUtils, logUtils } from '@0x/utils';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
|
||||
/* istanbul ignore next */
|
||||
// tslint:disable:no-parameter-reassignment
|
||||
// tslint:disable-next-line:class-name
|
||||
export class IValidatorContract extends BaseContract {
|
||||
public isValidSignature = {
|
||||
async callAsync(
|
||||
hash: string,
|
||||
signerAddress: string,
|
||||
signature: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<boolean
|
||||
> {
|
||||
const self = this as any as IValidatorContract;
|
||||
const functionSignature = 'isValidSignature(bytes32,address,bytes)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[hash,
|
||||
signerAddress,
|
||||
signature
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [hash,
|
||||
signerAddress,
|
||||
signature
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [hash,
|
||||
signerAddress,
|
||||
signature
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.isValidSignature;
|
||||
const encodedData = ethersFunction.encode([hash,
|
||||
signerAddress,
|
||||
signature
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'isValidSignature'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public static async deployFrom0xArtifactAsync(
|
||||
artifact: ContractArtifact,
|
||||
provider: Provider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<IValidatorContract> {
|
||||
if (_.isUndefined(artifact.compilerOutput)) {
|
||||
throw new Error('Compiler output not found in the artifact file');
|
||||
}
|
||||
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
||||
const abi = artifact.compilerOutput.abi;
|
||||
return IValidatorContract.deployAsync(bytecode, abi, provider, txDefaults, );
|
||||
}
|
||||
public static async deployAsync(
|
||||
bytecode: string,
|
||||
abi: ContractAbi,
|
||||
provider: Provider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<IValidatorContract> {
|
||||
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
|
||||
[] = BaseContract._formatABIDataItemList(
|
||||
constructorAbi.inputs,
|
||||
[],
|
||||
BaseContract._bigNumberToString,
|
||||
);
|
||||
const iface = new ethers.utils.Interface(abi);
|
||||
const deployInfo = iface.deployFunction;
|
||||
const txData = deployInfo.encode(bytecode, []);
|
||||
const web3Wrapper = new Web3Wrapper(provider);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{data: txData},
|
||||
txDefaults,
|
||||
web3Wrapper.estimateGasAsync.bind(web3Wrapper),
|
||||
);
|
||||
const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
logUtils.log(`transactionHash: ${txHash}`);
|
||||
const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
|
||||
logUtils.log(`IValidator successfully deployed at ${txReceipt.contractAddress}`);
|
||||
const contractInstance = new IValidatorContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
|
||||
contractInstance.constructorArgs = [];
|
||||
return contractInstance;
|
||||
}
|
||||
constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
|
||||
super('IValidator', abi, address, provider, txDefaults);
|
||||
classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
|
||||
}
|
||||
} // tslint:disable:max-file-line-count
|
||||
// tslint:enable:no-unbound-method
|
103
packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts
Normal file
103
packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts
Normal file
@@ -0,0 +1,103 @@
|
||||
// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
|
||||
// tslint:disable:no-unused-variable
|
||||
// tslint:disable:no-unbound-method
|
||||
import { BaseContract } from '@0x/base-contract';
|
||||
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
|
||||
import { BigNumber, classUtils, logUtils } from '@0x/utils';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
|
||||
/* istanbul ignore next */
|
||||
// tslint:disable:no-parameter-reassignment
|
||||
// tslint:disable-next-line:class-name
|
||||
export class IWalletContract extends BaseContract {
|
||||
public isValidSignature = {
|
||||
async callAsync(
|
||||
hash: string,
|
||||
signature: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<boolean
|
||||
> {
|
||||
const self = this as any as IWalletContract;
|
||||
const functionSignature = 'isValidSignature(bytes32,bytes)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[hash,
|
||||
signature
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [hash,
|
||||
signature
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [hash,
|
||||
signature
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.isValidSignature;
|
||||
const encodedData = ethersFunction.encode([hash,
|
||||
signature
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'isValidSignature'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public static async deployFrom0xArtifactAsync(
|
||||
artifact: ContractArtifact,
|
||||
provider: Provider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<IWalletContract> {
|
||||
if (_.isUndefined(artifact.compilerOutput)) {
|
||||
throw new Error('Compiler output not found in the artifact file');
|
||||
}
|
||||
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
||||
const abi = artifact.compilerOutput.abi;
|
||||
return IWalletContract.deployAsync(bytecode, abi, provider, txDefaults, );
|
||||
}
|
||||
public static async deployAsync(
|
||||
bytecode: string,
|
||||
abi: ContractAbi,
|
||||
provider: Provider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<IWalletContract> {
|
||||
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
|
||||
[] = BaseContract._formatABIDataItemList(
|
||||
constructorAbi.inputs,
|
||||
[],
|
||||
BaseContract._bigNumberToString,
|
||||
);
|
||||
const iface = new ethers.utils.Interface(abi);
|
||||
const deployInfo = iface.deployFunction;
|
||||
const txData = deployInfo.encode(bytecode, []);
|
||||
const web3Wrapper = new Web3Wrapper(provider);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{data: txData},
|
||||
txDefaults,
|
||||
web3Wrapper.estimateGasAsync.bind(web3Wrapper),
|
||||
);
|
||||
const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
logUtils.log(`transactionHash: ${txHash}`);
|
||||
const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
|
||||
logUtils.log(`IWallet successfully deployed at ${txReceipt.contractAddress}`);
|
||||
const contractInstance = new IWalletContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
|
||||
contractInstance.constructorArgs = [];
|
||||
return contractInstance;
|
||||
}
|
||||
constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
|
||||
super('IWallet', abi, address, provider, txDefaults);
|
||||
classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
|
||||
}
|
||||
} // tslint:disable:max-file-line-count
|
||||
// tslint:enable:no-unbound-method
|
@@ -0,0 +1,357 @@
|
||||
// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
|
||||
// tslint:disable:no-unused-variable
|
||||
// tslint:disable:no-unbound-method
|
||||
import { BaseContract } from '@0x/base-contract';
|
||||
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
|
||||
import { BigNumber, classUtils, logUtils } from '@0x/utils';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
|
||||
/* istanbul ignore next */
|
||||
// tslint:disable:no-parameter-reassignment
|
||||
// tslint:disable-next-line:class-name
|
||||
export class OrderValidatorContract extends BaseContract {
|
||||
public getOrderAndTraderInfo = {
|
||||
async callAsync(
|
||||
order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
|
||||
takerAddress: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<[{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 functionSignature = 'getOrderAndTraderInfo({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},address)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[order,
|
||||
takerAddress
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [order,
|
||||
takerAddress
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [order,
|
||||
takerAddress
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getOrderAndTraderInfo;
|
||||
const encodedData = ethersFunction.encode([order,
|
||||
takerAddress
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'getOrderAndTraderInfo'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray;
|
||||
},
|
||||
};
|
||||
public getBalanceAndAllowance = {
|
||||
async callAsync(
|
||||
target: string,
|
||||
assetData: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<[BigNumber, BigNumber]
|
||||
> {
|
||||
const self = this as any as OrderValidatorContract;
|
||||
const functionSignature = 'getBalanceAndAllowance(address,bytes)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[target,
|
||||
assetData
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target,
|
||||
assetData
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [target,
|
||||
assetData
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getBalanceAndAllowance;
|
||||
const encodedData = ethersFunction.encode([target,
|
||||
assetData
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'getBalanceAndAllowance'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray;
|
||||
},
|
||||
};
|
||||
public getOrdersAndTradersInfo = {
|
||||
async callAsync(
|
||||
orders: 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}>,
|
||||
takerAddresses: string[],
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<[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 functionSignature = 'getOrdersAndTradersInfo(tuple[],address[])';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[orders,
|
||||
takerAddresses
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [orders,
|
||||
takerAddresses
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [orders,
|
||||
takerAddresses
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getOrdersAndTradersInfo;
|
||||
const encodedData = ethersFunction.encode([orders,
|
||||
takerAddresses
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'getOrdersAndTradersInfo'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray;
|
||||
},
|
||||
};
|
||||
public getTradersInfo = {
|
||||
async callAsync(
|
||||
orders: 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}>,
|
||||
takerAddresses: string[],
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<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 functionSignature = 'getTradersInfo(tuple[],address[])';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[orders,
|
||||
takerAddresses
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [orders,
|
||||
takerAddresses
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [orders,
|
||||
takerAddresses
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getTradersInfo;
|
||||
const encodedData = ethersFunction.encode([orders,
|
||||
takerAddresses
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'getTradersInfo'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public getERC721TokenOwner = {
|
||||
async callAsync(
|
||||
token: string,
|
||||
tokenId: BigNumber,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
const self = this as any as OrderValidatorContract;
|
||||
const functionSignature = 'getERC721TokenOwner(address,uint256)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[token,
|
||||
tokenId
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [token,
|
||||
tokenId
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [token,
|
||||
tokenId
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getERC721TokenOwner;
|
||||
const encodedData = ethersFunction.encode([token,
|
||||
tokenId
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'getERC721TokenOwner'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public getBalancesAndAllowances = {
|
||||
async callAsync(
|
||||
target: string,
|
||||
assetData: string[],
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<[BigNumber[], BigNumber[]]
|
||||
> {
|
||||
const self = this as any as OrderValidatorContract;
|
||||
const functionSignature = 'getBalancesAndAllowances(address,bytes[])';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[target,
|
||||
assetData
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target,
|
||||
assetData
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [target,
|
||||
assetData
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getBalancesAndAllowances;
|
||||
const encodedData = ethersFunction.encode([target,
|
||||
assetData
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'getBalancesAndAllowances'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray;
|
||||
},
|
||||
};
|
||||
public getTraderInfo = {
|
||||
async callAsync(
|
||||
order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
|
||||
takerAddress: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<{makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}
|
||||
> {
|
||||
const self = this as any as OrderValidatorContract;
|
||||
const functionSignature = 'getTraderInfo({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},address)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[order,
|
||||
takerAddress
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [order,
|
||||
takerAddress
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [order,
|
||||
takerAddress
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getTraderInfo;
|
||||
const encodedData = ethersFunction.encode([order,
|
||||
takerAddress
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'getTraderInfo'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public static async deployFrom0xArtifactAsync(
|
||||
artifact: ContractArtifact,
|
||||
provider: Provider,
|
||||
txDefaults: Partial<TxData>,
|
||||
_exchange: string,
|
||||
_zrxAssetData: string,
|
||||
): Promise<OrderValidatorContract> {
|
||||
if (_.isUndefined(artifact.compilerOutput)) {
|
||||
throw new Error('Compiler output not found in the artifact file');
|
||||
}
|
||||
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
||||
const abi = artifact.compilerOutput.abi;
|
||||
return OrderValidatorContract.deployAsync(bytecode, abi, provider, txDefaults, _exchange,
|
||||
_zrxAssetData
|
||||
);
|
||||
}
|
||||
public static async deployAsync(
|
||||
bytecode: string,
|
||||
abi: ContractAbi,
|
||||
provider: Provider,
|
||||
txDefaults: Partial<TxData>,
|
||||
_exchange: string,
|
||||
_zrxAssetData: string,
|
||||
): Promise<OrderValidatorContract> {
|
||||
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
|
||||
[_exchange,
|
||||
_zrxAssetData
|
||||
] = BaseContract._formatABIDataItemList(
|
||||
constructorAbi.inputs,
|
||||
[_exchange,
|
||||
_zrxAssetData
|
||||
],
|
||||
BaseContract._bigNumberToString,
|
||||
);
|
||||
const iface = new ethers.utils.Interface(abi);
|
||||
const deployInfo = iface.deployFunction;
|
||||
const txData = deployInfo.encode(bytecode, [_exchange,
|
||||
_zrxAssetData
|
||||
]);
|
||||
const web3Wrapper = new Web3Wrapper(provider);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{data: txData},
|
||||
txDefaults,
|
||||
web3Wrapper.estimateGasAsync.bind(web3Wrapper),
|
||||
);
|
||||
const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
logUtils.log(`transactionHash: ${txHash}`);
|
||||
const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
|
||||
logUtils.log(`OrderValidator successfully deployed at ${txReceipt.contractAddress}`);
|
||||
const contractInstance = new OrderValidatorContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
|
||||
contractInstance.constructorArgs = [_exchange,
|
||||
_zrxAssetData
|
||||
];
|
||||
return contractInstance;
|
||||
}
|
||||
constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
|
||||
super('OrderValidator', abi, address, provider, txDefaults);
|
||||
classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
|
||||
}
|
||||
} // tslint:disable:max-file-line-count
|
||||
// tslint:enable:no-unbound-method
|
835
packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts
Normal file
835
packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts
Normal file
@@ -0,0 +1,835 @@
|
||||
// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
|
||||
// tslint:disable:no-unused-variable
|
||||
// tslint:disable:no-unbound-method
|
||||
import { BaseContract } from '@0x/base-contract';
|
||||
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
|
||||
import { BigNumber, classUtils, logUtils } from '@0x/utils';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
export type WETH9EventArgs =
|
||||
| WETH9ApprovalEventArgs
|
||||
| WETH9TransferEventArgs
|
||||
| WETH9DepositEventArgs
|
||||
| WETH9WithdrawalEventArgs;
|
||||
|
||||
export enum WETH9Events {
|
||||
Approval = 'Approval',
|
||||
Transfer = 'Transfer',
|
||||
Deposit = 'Deposit',
|
||||
Withdrawal = 'Withdrawal',
|
||||
}
|
||||
|
||||
export interface WETH9ApprovalEventArgs extends DecodedLogArgs {
|
||||
_owner: string;
|
||||
_spender: string;
|
||||
_value: BigNumber;
|
||||
}
|
||||
|
||||
export interface WETH9TransferEventArgs extends DecodedLogArgs {
|
||||
_from: string;
|
||||
_to: string;
|
||||
_value: BigNumber;
|
||||
}
|
||||
|
||||
export interface WETH9DepositEventArgs extends DecodedLogArgs {
|
||||
_owner: string;
|
||||
_value: BigNumber;
|
||||
}
|
||||
|
||||
export interface WETH9WithdrawalEventArgs extends DecodedLogArgs {
|
||||
_owner: string;
|
||||
_value: BigNumber;
|
||||
}
|
||||
|
||||
|
||||
/* istanbul ignore next */
|
||||
// tslint:disable:no-parameter-reassignment
|
||||
// tslint:disable-next-line:class-name
|
||||
export class WETH9Contract extends BaseContract {
|
||||
public name = {
|
||||
async callAsync(
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
const self = this as any as WETH9Contract;
|
||||
const functionSignature = 'name()';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, []);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.name;
|
||||
const encodedData = ethersFunction.encode([]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'name'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public approve = {
|
||||
async sendTransactionAsync(
|
||||
guy: string,
|
||||
wad: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as WETH9Contract;
|
||||
const inputAbi = self._lookupAbi('approve(address,uint256)').inputs;
|
||||
[guy,
|
||||
wad
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [guy,
|
||||
wad
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [guy,
|
||||
wad
|
||||
]);
|
||||
const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([guy,
|
||||
wad
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.approve.estimateGasAsync.bind(
|
||||
self,
|
||||
guy,
|
||||
wad
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
guy: string,
|
||||
wad: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as WETH9Contract;
|
||||
const inputAbi = self._lookupAbi('approve(address,uint256)').inputs;
|
||||
[guy,
|
||||
wad
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [guy,
|
||||
wad
|
||||
], BaseContract._bigNumberToString);
|
||||
const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([guy,
|
||||
wad
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
guy: string,
|
||||
wad: BigNumber,
|
||||
): string {
|
||||
const self = this as any as WETH9Contract;
|
||||
const inputAbi = self._lookupAbi('approve(address,uint256)').inputs;
|
||||
[guy,
|
||||
wad
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [guy,
|
||||
wad
|
||||
], BaseContract._bigNumberToString);
|
||||
const abiEncodedTransactionData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([guy,
|
||||
wad
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
guy: string,
|
||||
wad: BigNumber,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<boolean
|
||||
> {
|
||||
const self = this as any as WETH9Contract;
|
||||
const functionSignature = 'approve(address,uint256)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[guy,
|
||||
wad
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [guy,
|
||||
wad
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [guy,
|
||||
wad
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.approve;
|
||||
const encodedData = ethersFunction.encode([guy,
|
||||
wad
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'approve'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public totalSupply = {
|
||||
async callAsync(
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<BigNumber
|
||||
> {
|
||||
const self = this as any as WETH9Contract;
|
||||
const functionSignature = 'totalSupply()';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, []);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.totalSupply;
|
||||
const encodedData = ethersFunction.encode([]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'totalSupply'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public transferFrom = {
|
||||
async sendTransactionAsync(
|
||||
src: string,
|
||||
dst: string,
|
||||
wad: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as WETH9Contract;
|
||||
const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs;
|
||||
[src,
|
||||
dst,
|
||||
wad
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [src,
|
||||
dst,
|
||||
wad
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [src,
|
||||
dst,
|
||||
wad
|
||||
]);
|
||||
const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([src,
|
||||
dst,
|
||||
wad
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.transferFrom.estimateGasAsync.bind(
|
||||
self,
|
||||
src,
|
||||
dst,
|
||||
wad
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
src: string,
|
||||
dst: string,
|
||||
wad: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as WETH9Contract;
|
||||
const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs;
|
||||
[src,
|
||||
dst,
|
||||
wad
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [src,
|
||||
dst,
|
||||
wad
|
||||
], BaseContract._bigNumberToString);
|
||||
const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([src,
|
||||
dst,
|
||||
wad
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
src: string,
|
||||
dst: string,
|
||||
wad: BigNumber,
|
||||
): string {
|
||||
const self = this as any as WETH9Contract;
|
||||
const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs;
|
||||
[src,
|
||||
dst,
|
||||
wad
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [src,
|
||||
dst,
|
||||
wad
|
||||
], BaseContract._bigNumberToString);
|
||||
const abiEncodedTransactionData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([src,
|
||||
dst,
|
||||
wad
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
src: string,
|
||||
dst: string,
|
||||
wad: BigNumber,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<boolean
|
||||
> {
|
||||
const self = this as any as WETH9Contract;
|
||||
const functionSignature = 'transferFrom(address,address,uint256)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[src,
|
||||
dst,
|
||||
wad
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [src,
|
||||
dst,
|
||||
wad
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [src,
|
||||
dst,
|
||||
wad
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferFrom;
|
||||
const encodedData = ethersFunction.encode([src,
|
||||
dst,
|
||||
wad
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'transferFrom'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public withdraw = {
|
||||
async sendTransactionAsync(
|
||||
wad: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as WETH9Contract;
|
||||
const inputAbi = self._lookupAbi('withdraw(uint256)').inputs;
|
||||
[wad
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [wad
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [wad
|
||||
]);
|
||||
const encodedData = self._lookupEthersInterface('withdraw(uint256)').functions.withdraw.encode([wad
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.withdraw.estimateGasAsync.bind(
|
||||
self,
|
||||
wad
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
wad: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as WETH9Contract;
|
||||
const inputAbi = self._lookupAbi('withdraw(uint256)').inputs;
|
||||
[wad
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [wad
|
||||
], BaseContract._bigNumberToString);
|
||||
const encodedData = self._lookupEthersInterface('withdraw(uint256)').functions.withdraw.encode([wad
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
wad: BigNumber,
|
||||
): string {
|
||||
const self = this as any as WETH9Contract;
|
||||
const inputAbi = self._lookupAbi('withdraw(uint256)').inputs;
|
||||
[wad
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [wad
|
||||
], BaseContract._bigNumberToString);
|
||||
const abiEncodedTransactionData = self._lookupEthersInterface('withdraw(uint256)').functions.withdraw.encode([wad
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
wad: BigNumber,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
const self = this as any as WETH9Contract;
|
||||
const functionSignature = 'withdraw(uint256)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[wad
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [wad
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [wad
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.withdraw;
|
||||
const encodedData = ethersFunction.encode([wad
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'withdraw'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray;
|
||||
},
|
||||
};
|
||||
public decimals = {
|
||||
async callAsync(
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<number
|
||||
> {
|
||||
const self = this as any as WETH9Contract;
|
||||
const functionSignature = 'decimals()';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, []);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.decimals;
|
||||
const encodedData = ethersFunction.encode([]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'decimals'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public balanceOf = {
|
||||
async callAsync(
|
||||
index_0: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<BigNumber
|
||||
> {
|
||||
const self = this as any as WETH9Contract;
|
||||
const functionSignature = 'balanceOf(address)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[index_0
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [index_0
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.balanceOf;
|
||||
const encodedData = ethersFunction.encode([index_0
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'balanceOf'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public symbol = {
|
||||
async callAsync(
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
const self = this as any as WETH9Contract;
|
||||
const functionSignature = 'symbol()';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, []);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.symbol;
|
||||
const encodedData = ethersFunction.encode([]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'symbol'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public transfer = {
|
||||
async sendTransactionAsync(
|
||||
dst: string,
|
||||
wad: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as WETH9Contract;
|
||||
const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs;
|
||||
[dst,
|
||||
wad
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [dst,
|
||||
wad
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [dst,
|
||||
wad
|
||||
]);
|
||||
const encodedData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([dst,
|
||||
wad
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.transfer.estimateGasAsync.bind(
|
||||
self,
|
||||
dst,
|
||||
wad
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
dst: string,
|
||||
wad: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as WETH9Contract;
|
||||
const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs;
|
||||
[dst,
|
||||
wad
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [dst,
|
||||
wad
|
||||
], BaseContract._bigNumberToString);
|
||||
const encodedData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([dst,
|
||||
wad
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
dst: string,
|
||||
wad: BigNumber,
|
||||
): string {
|
||||
const self = this as any as WETH9Contract;
|
||||
const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs;
|
||||
[dst,
|
||||
wad
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [dst,
|
||||
wad
|
||||
], BaseContract._bigNumberToString);
|
||||
const abiEncodedTransactionData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([dst,
|
||||
wad
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
dst: string,
|
||||
wad: BigNumber,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<boolean
|
||||
> {
|
||||
const self = this as any as WETH9Contract;
|
||||
const functionSignature = 'transfer(address,uint256)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[dst,
|
||||
wad
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [dst,
|
||||
wad
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [dst,
|
||||
wad
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transfer;
|
||||
const encodedData = ethersFunction.encode([dst,
|
||||
wad
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'transfer'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public deposit = {
|
||||
async sendTransactionAsync(
|
||||
txData: Partial<TxDataPayable> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as WETH9Contract;
|
||||
const inputAbi = self._lookupAbi('deposit()').inputs;
|
||||
[] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, []);
|
||||
const encodedData = self._lookupEthersInterface('deposit()').functions.deposit.encode([]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.deposit.estimateGasAsync.bind(
|
||||
self,
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as WETH9Contract;
|
||||
const inputAbi = self._lookupAbi('deposit()').inputs;
|
||||
[] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString);
|
||||
const encodedData = self._lookupEthersInterface('deposit()').functions.deposit.encode([]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
): string {
|
||||
const self = this as any as WETH9Contract;
|
||||
const inputAbi = self._lookupAbi('deposit()').inputs;
|
||||
[] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString);
|
||||
const abiEncodedTransactionData = self._lookupEthersInterface('deposit()').functions.deposit.encode([]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
const self = this as any as WETH9Contract;
|
||||
const functionSignature = 'deposit()';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, []);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.deposit;
|
||||
const encodedData = ethersFunction.encode([]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'deposit'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray;
|
||||
},
|
||||
};
|
||||
public allowance = {
|
||||
async callAsync(
|
||||
index_0: string,
|
||||
index_1: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<BigNumber
|
||||
> {
|
||||
const self = this as any as WETH9Contract;
|
||||
const functionSignature = 'allowance(address,address)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[index_0,
|
||||
index_1
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [index_0,
|
||||
index_1
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0,
|
||||
index_1
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.allowance;
|
||||
const encodedData = ethersFunction.encode([index_0,
|
||||
index_1
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'allowance'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public static async deployFrom0xArtifactAsync(
|
||||
artifact: ContractArtifact,
|
||||
provider: Provider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<WETH9Contract> {
|
||||
if (_.isUndefined(artifact.compilerOutput)) {
|
||||
throw new Error('Compiler output not found in the artifact file');
|
||||
}
|
||||
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
||||
const abi = artifact.compilerOutput.abi;
|
||||
return WETH9Contract.deployAsync(bytecode, abi, provider, txDefaults, );
|
||||
}
|
||||
public static async deployAsync(
|
||||
bytecode: string,
|
||||
abi: ContractAbi,
|
||||
provider: Provider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<WETH9Contract> {
|
||||
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
|
||||
[] = BaseContract._formatABIDataItemList(
|
||||
constructorAbi.inputs,
|
||||
[],
|
||||
BaseContract._bigNumberToString,
|
||||
);
|
||||
const iface = new ethers.utils.Interface(abi);
|
||||
const deployInfo = iface.deployFunction;
|
||||
const txData = deployInfo.encode(bytecode, []);
|
||||
const web3Wrapper = new Web3Wrapper(provider);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{data: txData},
|
||||
txDefaults,
|
||||
web3Wrapper.estimateGasAsync.bind(web3Wrapper),
|
||||
);
|
||||
const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
logUtils.log(`transactionHash: ${txHash}`);
|
||||
const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
|
||||
logUtils.log(`WETH9 successfully deployed at ${txReceipt.contractAddress}`);
|
||||
const contractInstance = new WETH9Contract(abi, txReceipt.contractAddress as string, provider, txDefaults);
|
||||
contractInstance.constructorArgs = [];
|
||||
return contractInstance;
|
||||
}
|
||||
constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
|
||||
super('WETH9', abi, address, provider, txDefaults);
|
||||
classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
|
||||
}
|
||||
} // tslint:disable:max-file-line-count
|
||||
// tslint:enable:no-unbound-method
|
646
packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts
Normal file
646
packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts
Normal file
@@ -0,0 +1,646 @@
|
||||
// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
|
||||
// tslint:disable:no-unused-variable
|
||||
// tslint:disable:no-unbound-method
|
||||
import { BaseContract } from '@0x/base-contract';
|
||||
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
|
||||
import { BigNumber, classUtils, logUtils } from '@0x/utils';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
export type ZRXTokenEventArgs =
|
||||
| ZRXTokenTransferEventArgs
|
||||
| ZRXTokenApprovalEventArgs;
|
||||
|
||||
export enum ZRXTokenEvents {
|
||||
Transfer = 'Transfer',
|
||||
Approval = 'Approval',
|
||||
}
|
||||
|
||||
export interface ZRXTokenTransferEventArgs extends DecodedLogArgs {
|
||||
_from: string;
|
||||
_to: string;
|
||||
_value: BigNumber;
|
||||
}
|
||||
|
||||
export interface ZRXTokenApprovalEventArgs extends DecodedLogArgs {
|
||||
_owner: string;
|
||||
_spender: string;
|
||||
_value: BigNumber;
|
||||
}
|
||||
|
||||
|
||||
/* istanbul ignore next */
|
||||
// tslint:disable:no-parameter-reassignment
|
||||
// tslint:disable-next-line:class-name
|
||||
export class ZRXTokenContract extends BaseContract {
|
||||
public name = {
|
||||
async callAsync(
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const functionSignature = 'name()';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, []);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.name;
|
||||
const encodedData = ethersFunction.encode([]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'name'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public approve = {
|
||||
async sendTransactionAsync(
|
||||
_spender: string,
|
||||
_value: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const inputAbi = self._lookupAbi('approve(address,uint256)').inputs;
|
||||
[_spender,
|
||||
_value
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [_spender,
|
||||
_value
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [_spender,
|
||||
_value
|
||||
]);
|
||||
const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_spender,
|
||||
_value
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.approve.estimateGasAsync.bind(
|
||||
self,
|
||||
_spender,
|
||||
_value
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
_spender: string,
|
||||
_value: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const inputAbi = self._lookupAbi('approve(address,uint256)').inputs;
|
||||
[_spender,
|
||||
_value
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [_spender,
|
||||
_value
|
||||
], BaseContract._bigNumberToString);
|
||||
const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_spender,
|
||||
_value
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
_spender: string,
|
||||
_value: BigNumber,
|
||||
): string {
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const inputAbi = self._lookupAbi('approve(address,uint256)').inputs;
|
||||
[_spender,
|
||||
_value
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [_spender,
|
||||
_value
|
||||
], BaseContract._bigNumberToString);
|
||||
const abiEncodedTransactionData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_spender,
|
||||
_value
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
_spender: string,
|
||||
_value: BigNumber,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<boolean
|
||||
> {
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const functionSignature = 'approve(address,uint256)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[_spender,
|
||||
_value
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [_spender,
|
||||
_value
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [_spender,
|
||||
_value
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.approve;
|
||||
const encodedData = ethersFunction.encode([_spender,
|
||||
_value
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'approve'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public totalSupply = {
|
||||
async callAsync(
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<BigNumber
|
||||
> {
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const functionSignature = 'totalSupply()';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, []);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.totalSupply;
|
||||
const encodedData = ethersFunction.encode([]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'totalSupply'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public transferFrom = {
|
||||
async sendTransactionAsync(
|
||||
_from: string,
|
||||
_to: string,
|
||||
_value: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs;
|
||||
[_from,
|
||||
_to,
|
||||
_value
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [_from,
|
||||
_to,
|
||||
_value
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [_from,
|
||||
_to,
|
||||
_value
|
||||
]);
|
||||
const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from,
|
||||
_to,
|
||||
_value
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.transferFrom.estimateGasAsync.bind(
|
||||
self,
|
||||
_from,
|
||||
_to,
|
||||
_value
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
_from: string,
|
||||
_to: string,
|
||||
_value: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs;
|
||||
[_from,
|
||||
_to,
|
||||
_value
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [_from,
|
||||
_to,
|
||||
_value
|
||||
], BaseContract._bigNumberToString);
|
||||
const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from,
|
||||
_to,
|
||||
_value
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
_from: string,
|
||||
_to: string,
|
||||
_value: BigNumber,
|
||||
): string {
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs;
|
||||
[_from,
|
||||
_to,
|
||||
_value
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [_from,
|
||||
_to,
|
||||
_value
|
||||
], BaseContract._bigNumberToString);
|
||||
const abiEncodedTransactionData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from,
|
||||
_to,
|
||||
_value
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
_from: string,
|
||||
_to: string,
|
||||
_value: BigNumber,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<boolean
|
||||
> {
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const functionSignature = 'transferFrom(address,address,uint256)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[_from,
|
||||
_to,
|
||||
_value
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [_from,
|
||||
_to,
|
||||
_value
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [_from,
|
||||
_to,
|
||||
_value
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferFrom;
|
||||
const encodedData = ethersFunction.encode([_from,
|
||||
_to,
|
||||
_value
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'transferFrom'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public decimals = {
|
||||
async callAsync(
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<number
|
||||
> {
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const functionSignature = 'decimals()';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, []);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.decimals;
|
||||
const encodedData = ethersFunction.encode([]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'decimals'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public balanceOf = {
|
||||
async callAsync(
|
||||
_owner: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<BigNumber
|
||||
> {
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const functionSignature = 'balanceOf(address)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[_owner
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [_owner
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [_owner
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.balanceOf;
|
||||
const encodedData = ethersFunction.encode([_owner
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'balanceOf'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public symbol = {
|
||||
async callAsync(
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const functionSignature = 'symbol()';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, []);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.symbol;
|
||||
const encodedData = ethersFunction.encode([]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'symbol'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public transfer = {
|
||||
async sendTransactionAsync(
|
||||
_to: string,
|
||||
_value: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs;
|
||||
[_to,
|
||||
_value
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [_to,
|
||||
_value
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [_to,
|
||||
_value
|
||||
]);
|
||||
const encodedData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([_to,
|
||||
_value
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.transfer.estimateGasAsync.bind(
|
||||
self,
|
||||
_to,
|
||||
_value
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
_to: string,
|
||||
_value: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs;
|
||||
[_to,
|
||||
_value
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [_to,
|
||||
_value
|
||||
], BaseContract._bigNumberToString);
|
||||
const encodedData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([_to,
|
||||
_value
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
_to: string,
|
||||
_value: BigNumber,
|
||||
): string {
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs;
|
||||
[_to,
|
||||
_value
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [_to,
|
||||
_value
|
||||
], BaseContract._bigNumberToString);
|
||||
const abiEncodedTransactionData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([_to,
|
||||
_value
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
_to: string,
|
||||
_value: BigNumber,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<boolean
|
||||
> {
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const functionSignature = 'transfer(address,uint256)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[_to,
|
||||
_value
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [_to,
|
||||
_value
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [_to,
|
||||
_value
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transfer;
|
||||
const encodedData = ethersFunction.encode([_to,
|
||||
_value
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'transfer'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public allowance = {
|
||||
async callAsync(
|
||||
_owner: string,
|
||||
_spender: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<BigNumber
|
||||
> {
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const functionSignature = 'allowance(address,address)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[_owner,
|
||||
_spender
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [_owner,
|
||||
_spender
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [_owner,
|
||||
_spender
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.allowance;
|
||||
const encodedData = ethersFunction.encode([_owner,
|
||||
_spender
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'allowance'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public static async deployFrom0xArtifactAsync(
|
||||
artifact: ContractArtifact,
|
||||
provider: Provider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<ZRXTokenContract> {
|
||||
if (_.isUndefined(artifact.compilerOutput)) {
|
||||
throw new Error('Compiler output not found in the artifact file');
|
||||
}
|
||||
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
||||
const abi = artifact.compilerOutput.abi;
|
||||
return ZRXTokenContract.deployAsync(bytecode, abi, provider, txDefaults, );
|
||||
}
|
||||
public static async deployAsync(
|
||||
bytecode: string,
|
||||
abi: ContractAbi,
|
||||
provider: Provider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<ZRXTokenContract> {
|
||||
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
|
||||
[] = BaseContract._formatABIDataItemList(
|
||||
constructorAbi.inputs,
|
||||
[],
|
||||
BaseContract._bigNumberToString,
|
||||
);
|
||||
const iface = new ethers.utils.Interface(abi);
|
||||
const deployInfo = iface.deployFunction;
|
||||
const txData = deployInfo.encode(bytecode, []);
|
||||
const web3Wrapper = new Web3Wrapper(provider);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{data: txData},
|
||||
txDefaults,
|
||||
web3Wrapper.estimateGasAsync.bind(web3Wrapper),
|
||||
);
|
||||
const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
logUtils.log(`transactionHash: ${txHash}`);
|
||||
const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
|
||||
logUtils.log(`ZRXToken successfully deployed at ${txReceipt.contractAddress}`);
|
||||
const contractInstance = new ZRXTokenContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
|
||||
contractInstance.constructorArgs = [];
|
||||
return contractInstance;
|
||||
}
|
||||
constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
|
||||
super('ZRXToken', abi, address, provider, txDefaults);
|
||||
classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
|
||||
}
|
||||
} // tslint:disable:max-file-line-count
|
||||
// tslint:enable:no-unbound-method
|
14
packages/abi-gen-wrappers/src/index.ts
Normal file
14
packages/abi-gen-wrappers/src/index.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
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/erc20_proxy';
|
||||
export * from './generated-wrappers/erc20_token';
|
||||
export * from './generated-wrappers/erc721_proxy';
|
||||
export * from './generated-wrappers/erc721_token';
|
||||
export * from './generated-wrappers/exchange';
|
||||
export * from './generated-wrappers/forwarder';
|
||||
export * from './generated-wrappers/i_validator';
|
||||
export * from './generated-wrappers/i_wallet';
|
||||
export * from './generated-wrappers/order_validator';
|
||||
export * from './generated-wrappers/weth9';
|
||||
export * from './generated-wrappers/zrx_token';
|
@@ -4,5 +4,5 @@
|
||||
"outDir": "lib",
|
||||
"rootDir": "."
|
||||
},
|
||||
"include": ["./src/**/*", "./test/**/*"]
|
||||
"include": ["./src/**/*"]
|
||||
}
|
3
packages/abi-gen-wrappers/tslint.json
Normal file
3
packages/abi-gen-wrappers/tslint.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": ["@0x/tslint-config"]
|
||||
}
|
@@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1539871071,
|
||||
"version": "1.0.14",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "1.0.13",
|
||||
"changes": [
|
||||
|
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v1.0.14 - _October 18, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.0.13 - _October 4, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
@@ -37,7 +41,7 @@ CHANGELOG
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.0.5 - _August 13, 2018_
|
||||
## v1.0.5 - _August 14, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
|
@@ -8,7 +8,7 @@ You can write your custom handlebars templates which will allow you to seamlessl
|
||||
|
||||
## Installation
|
||||
|
||||
`yarn add -g @0xproject/abi-gen`
|
||||
`yarn add -g @0x/abi-gen`
|
||||
|
||||
## Usage
|
||||
|
||||
@@ -82,13 +82,13 @@ yarn install
|
||||
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
|
||||
|
||||
```bash
|
||||
PKG=@0xproject/abi-gen yarn build
|
||||
PKG=@0x/abi-gen yarn build
|
||||
```
|
||||
|
||||
Or continuously rebuild on change:
|
||||
|
||||
```bash
|
||||
PKG=@0xproject/abi-gen yarn watch
|
||||
PKG=@0x/abi-gen yarn watch
|
||||
```
|
||||
|
||||
### Clean
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0xproject/abi-gen",
|
||||
"version": "1.0.13",
|
||||
"name": "@0x/abi-gen",
|
||||
"version": "1.0.14",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -31,10 +31,10 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/0x-monorepo/packages/abi-gen/README.md",
|
||||
"dependencies": {
|
||||
"@0xproject/typescript-typings": "^3.0.2",
|
||||
"@0xproject/utils": "^2.0.2",
|
||||
"@0x/typescript-typings": "^3.0.3",
|
||||
"@0x/utils": "^2.0.3",
|
||||
"chalk": "^2.3.0",
|
||||
"ethereum-types": "^1.0.11",
|
||||
"ethereum-types": "^1.1.1",
|
||||
"glob": "^7.1.2",
|
||||
"handlebars": "^4.0.11",
|
||||
"lodash": "^4.17.5",
|
||||
@@ -45,7 +45,7 @@
|
||||
"yargs": "^10.0.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@0xproject/tslint-config": "^1.0.8",
|
||||
"@0x/tslint-config": "^1.0.9",
|
||||
"@types/glob": "5.0.35",
|
||||
"@types/handlebars": "^4.0.36",
|
||||
"@types/mkdirp": "^0.5.1",
|
||||
@@ -54,7 +54,6 @@
|
||||
"@types/tmp": "^0.0.33",
|
||||
"@types/yargs": "^10.0.0",
|
||||
"chai": "^4.1.2",
|
||||
"copyfiles": "^2.0.0",
|
||||
"dirty-chai": "^2.0.1",
|
||||
"make-promises-safe": "^1.1.0",
|
||||
"mocha": "^5.2.0",
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
import { abiUtils, logUtils } from '@0xproject/utils';
|
||||
import { abiUtils, logUtils } from '@0x/utils';
|
||||
import chalk from 'chalk';
|
||||
import { AbiDefinition, ConstructorAbi, EventAbi, MethodAbi } from 'ethereum-types';
|
||||
import { sync as globSync } from 'glob';
|
||||
|
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"extends": ["@0xproject/tslint-config"]
|
||||
"extends": ["@0x/tslint-config"]
|
||||
}
|
||||
|
@@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1539871071,
|
||||
"version": "1.0.14",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "1.0.13",
|
||||
"changes": [
|
||||
|
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v1.0.14 - _October 18, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.0.13 - _October 4, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
@@ -37,7 +41,7 @@ CHANGELOG
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.0.5 - _August 13, 2018_
|
||||
## v1.0.5 - _August 14, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
|
@@ -1,17 +1,17 @@
|
||||
## @0xproject/assert
|
||||
## @0x/assert
|
||||
|
||||
Standard type and schema assertions to be used across all 0x projects and packages
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
yarn add @0xproject/assert
|
||||
yarn add @0x/assert
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```typescript
|
||||
import { assert } from '@0xproject/assert';
|
||||
import { assert } from '@0x/assert';
|
||||
|
||||
assert.isValidBaseUnitAmount('baseUnitAmount', baseUnitAmount);
|
||||
```
|
||||
@@ -20,7 +20,7 @@ If your project is in [TypeScript](https://www.typescriptlang.org/), add the fol
|
||||
|
||||
```json
|
||||
"compilerOptions": {
|
||||
"typeRoots": ["node_modules/@0xproject/typescript-typings/types", "node_modules/@types"],
|
||||
"typeRoots": ["node_modules/@0x/typescript-typings/types", "node_modules/@types"],
|
||||
}
|
||||
```
|
||||
|
||||
@@ -49,13 +49,13 @@ yarn install
|
||||
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
|
||||
|
||||
```bash
|
||||
PKG=@0xproject/assert yarn build
|
||||
PKG=@0x/assert yarn build
|
||||
```
|
||||
|
||||
Or continuously rebuild on change:
|
||||
|
||||
```bash
|
||||
PKG=@0xproject/assert yarn watch
|
||||
PKG=@0x/assert yarn watch
|
||||
```
|
||||
|
||||
### Clean
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0xproject/assert",
|
||||
"version": "1.0.13",
|
||||
"name": "@0x/assert",
|
||||
"version": "1.0.14",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -29,12 +29,11 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/0x-monorepo/packages/assert/README.md",
|
||||
"devDependencies": {
|
||||
"@0xproject/tslint-config": "^1.0.8",
|
||||
"@0x/tslint-config": "^1.0.9",
|
||||
"@types/lodash": "4.14.104",
|
||||
"@types/mocha": "^2.2.42",
|
||||
"@types/valid-url": "^1.0.2",
|
||||
"chai": "^4.0.1",
|
||||
"copyfiles": "^2.0.0",
|
||||
"dirty-chai": "^2.0.1",
|
||||
"make-promises-safe": "^1.1.0",
|
||||
"mocha": "^4.1.0",
|
||||
@@ -45,9 +44,9 @@
|
||||
"typescript": "3.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0xproject/json-schemas": "^1.0.7",
|
||||
"@0xproject/typescript-typings": "^3.0.2",
|
||||
"@0xproject/utils": "^2.0.2",
|
||||
"@0x/json-schemas": "^2.0.0",
|
||||
"@0x/typescript-typings": "^3.0.3",
|
||||
"@0x/utils": "^2.0.3",
|
||||
"lodash": "^4.17.5",
|
||||
"valid-url": "^1.0.9"
|
||||
},
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { Schema, SchemaValidator } from '@0xproject/json-schemas';
|
||||
import { addressUtils, BigNumber } from '@0xproject/utils';
|
||||
import { Schema, SchemaValidator } from '@0x/json-schemas';
|
||||
import { addressUtils, BigNumber } from '@0x/utils';
|
||||
import * as _ from 'lodash';
|
||||
import * as validUrl from 'valid-url';
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { schemas } from '@0xproject/json-schemas';
|
||||
import { BigNumber } from '@0xproject/utils';
|
||||
import { schemas } from '@0x/json-schemas';
|
||||
import { BigNumber } from '@0x/utils';
|
||||
import * as chai from 'chai';
|
||||
import * as dirtyChai from 'dirty-chai';
|
||||
import 'mocha';
|
||||
|
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"extends": ["@0xproject/tslint-config"]
|
||||
"extends": ["@0x/tslint-config"]
|
||||
}
|
||||
|
@@ -1,4 +1,34 @@
|
||||
[
|
||||
{
|
||||
"version": "2.1.0",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Add `gasLimit` and `gasPrice` as optional properties on `BuyQuoteExecutionOpts`"
|
||||
},
|
||||
{
|
||||
"note": "Export `BuyQuoteInfo` type",
|
||||
"pr": 1131
|
||||
},
|
||||
{
|
||||
"note":
|
||||
"Updated to use new modularized artifacts and the latest version of @0xproject/contract-wrappers",
|
||||
"pr": 1105
|
||||
},
|
||||
{
|
||||
"note": "Add `gasLimit` and `gasPrice` as optional properties on `BuyQuoteExecutionOpts`",
|
||||
"pr": 1116
|
||||
},
|
||||
{
|
||||
"note": "Add `docs:json` command to package.json",
|
||||
"pr": 1139
|
||||
},
|
||||
{
|
||||
"note": "Add missing types to public interface",
|
||||
"pr": 1139
|
||||
}
|
||||
],
|
||||
"timestamp": 1539871071
|
||||
},
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"changes": [
|
||||
|
@@ -5,6 +5,15 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v2.1.0 - _October 18, 2018_
|
||||
|
||||
* Add `gasLimit` and `gasPrice` as optional properties on `BuyQuoteExecutionOpts`
|
||||
* Export `BuyQuoteInfo` type (#1131)
|
||||
* Updated to use new modularized artifacts and the latest version of @0xproject/contract-wrappers (#1105)
|
||||
* Add `gasLimit` and `gasPrice` as optional properties on `BuyQuoteExecutionOpts` (#1116)
|
||||
* Add `docs:json` command to package.json (#1139)
|
||||
* Add missing types to public interface (#1139)
|
||||
|
||||
## v2.0.0 - _October 4, 2018_
|
||||
|
||||
* Expand AssetBuyer to work with multiple assets at once (#1086)
|
||||
|
@@ -1,4 +1,4 @@
|
||||
## @0xproject/asset-buyer
|
||||
## @0x/asset-buyer
|
||||
|
||||
**Warning: In Beta, has not been extensively tested.**
|
||||
|
||||
@@ -9,26 +9,26 @@ In its more advanced and useful form, it integrates with the [Standard Relayer A
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
yarn add @0xproject/asset-buyer
|
||||
yarn add @0x/asset-buyer
|
||||
```
|
||||
|
||||
**Import**
|
||||
|
||||
```typescript
|
||||
import { AssetBuyer } from '@0xproject/asset-buyer';
|
||||
import { AssetBuyer } from '@0x/asset-buyer';
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```javascript
|
||||
var AssetBuyer = require('@0xproject/asset-buyer').AssetBuyer;
|
||||
var AssetBuyer = require('@0x/asset-buyer').AssetBuyer;
|
||||
```
|
||||
|
||||
If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`:
|
||||
|
||||
```json
|
||||
"compilerOptions": {
|
||||
"typeRoots": ["node_modules/@0xproject/typescript-typings/types", "node_modules/@types"],
|
||||
"typeRoots": ["node_modules/@0x/typescript-typings/types", "node_modules/@types"],
|
||||
}
|
||||
```
|
||||
|
||||
@@ -57,13 +57,13 @@ yarn install
|
||||
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
|
||||
|
||||
```bash
|
||||
PKG=@0xproject/asset-buyer yarn build
|
||||
PKG=@0x/asset-buyer yarn build
|
||||
```
|
||||
|
||||
Or continuously rebuild on change:
|
||||
|
||||
```bash
|
||||
PKG=@0xproject/asset-buyer yarn watch
|
||||
PKG=@0x/asset-buyer yarn watch
|
||||
```
|
||||
|
||||
### Clean
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0xproject/asset-buyer",
|
||||
"version": "2.0.0",
|
||||
"name": "@0x/asset-buyer",
|
||||
"version": "2.1.0",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -8,7 +8,8 @@
|
||||
"main": "lib/src/index.js",
|
||||
"types": "lib/src/index.d.ts",
|
||||
"scripts": {
|
||||
"watch_without_deps": "tsc -w",
|
||||
"build": "yarn tsc -b",
|
||||
"build:ci": "yarn build",
|
||||
"lint": "tslint --project .",
|
||||
"test": "yarn run_mocha",
|
||||
"rebuild_and_test": "run-s clean build test",
|
||||
@@ -16,10 +17,8 @@
|
||||
"coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info",
|
||||
"test:circleci": "yarn test:coverage",
|
||||
"run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js --exit",
|
||||
"clean": "shx rm -rf lib test_temp scripts",
|
||||
"build": "tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts",
|
||||
"build:ci": "yarn build",
|
||||
"manual:postpublish": "yarn build; node ./scripts/postpublish.js"
|
||||
"clean": "shx rm -rf lib test_temp",
|
||||
"docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --tsconfig typedoc-tsconfig.json --json $JSON_FILE_PATH $PROJECT_FILES"
|
||||
},
|
||||
"config": {
|
||||
"postpublish": {
|
||||
@@ -37,28 +36,27 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/0x-monorepo/packages/asset-buyer/README.md",
|
||||
"dependencies": {
|
||||
"@0xproject/assert": "^1.0.13",
|
||||
"@0xproject/connect": "^3.0.1",
|
||||
"@0xproject/contract-wrappers": "^2.0.2",
|
||||
"@0xproject/json-schemas": "^1.0.7",
|
||||
"@0xproject/order-utils": "^1.0.7",
|
||||
"@0xproject/subproviders": "^2.0.7",
|
||||
"@0xproject/types": "^1.1.4",
|
||||
"@0xproject/typescript-typings": "^3.0.2",
|
||||
"@0xproject/utils": "^2.0.2",
|
||||
"@0xproject/web3-wrapper": "^3.0.3",
|
||||
"ethereum-types": "^1.0.11",
|
||||
"@0x/assert": "^1.0.14",
|
||||
"@0x/connect": "^3.0.2",
|
||||
"@0x/contract-wrappers": "^3.0.0",
|
||||
"@0x/json-schemas": "^2.0.0",
|
||||
"@0x/order-utils": "^2.0.0",
|
||||
"@0x/subproviders": "^2.1.0",
|
||||
"@0x/types": "^1.2.0",
|
||||
"@0x/typescript-typings": "^3.0.3",
|
||||
"@0x/utils": "^2.0.3",
|
||||
"@0x/web3-wrapper": "^3.1.0",
|
||||
"ethereum-types": "^1.1.1",
|
||||
"lodash": "^4.17.10"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@0xproject/tslint-config": "^1.0.8",
|
||||
"@0x/tslint-config": "^1.0.9",
|
||||
"@types/lodash": "^4.14.116",
|
||||
"@types/mocha": "^2.2.42",
|
||||
"@types/node": "*",
|
||||
"chai": "^4.0.1",
|
||||
"chai-as-promised": "^7.1.0",
|
||||
"chai-bignumber": "^2.0.1",
|
||||
"copyfiles": "^1.2.0",
|
||||
"dirty-chai": "^2.0.1",
|
||||
"make-promises-safe": "^1.1.0",
|
||||
"mocha": "^4.1.0",
|
||||
@@ -66,7 +64,7 @@
|
||||
"nyc": "^11.0.1",
|
||||
"shx": "^0.2.2",
|
||||
"tslint": "5.11.0",
|
||||
"typedoc": "0.12.0",
|
||||
"typedoc": "0.13.0",
|
||||
"typescript": "3.0.1"
|
||||
},
|
||||
"publishConfig": {
|
||||
|
@@ -1,9 +1,9 @@
|
||||
import { ContractWrappers } from '@0xproject/contract-wrappers';
|
||||
import { schemas } from '@0xproject/json-schemas';
|
||||
import { SignedOrder } from '@0xproject/order-utils';
|
||||
import { ObjectMap } from '@0xproject/types';
|
||||
import { BigNumber } from '@0xproject/utils';
|
||||
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||
import { ContractWrappers } from '@0x/contract-wrappers';
|
||||
import { schemas } from '@0x/json-schemas';
|
||||
import { SignedOrder } from '@0x/order-utils';
|
||||
import { ObjectMap } from '@0x/types';
|
||||
import { BigNumber } from '@0x/utils';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { Provider } from 'ethereum-types';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
@@ -183,7 +183,7 @@ export class AssetBuyer {
|
||||
buyQuote: BuyQuote,
|
||||
options: Partial<BuyQuoteExecutionOpts> = {},
|
||||
): Promise<string> {
|
||||
const { ethAmount, takerAddress, feeRecipient } = {
|
||||
const { ethAmount, takerAddress, feeRecipient, gasLimit, gasPrice } = {
|
||||
...constants.DEFAULT_BUY_QUOTE_EXECUTION_OPTS,
|
||||
...options,
|
||||
};
|
||||
@@ -219,6 +219,10 @@ export class AssetBuyer {
|
||||
feeOrders,
|
||||
feePercentage,
|
||||
feeRecipient,
|
||||
{
|
||||
gasLimit,
|
||||
gasPrice,
|
||||
},
|
||||
);
|
||||
return txHash;
|
||||
}
|
||||
@@ -279,13 +283,13 @@ export class AssetBuyer {
|
||||
* Will throw if WETH does not exist for the current network.
|
||||
*/
|
||||
private _getEtherTokenAssetDataOrThrow(): string {
|
||||
return assetDataUtils.getEtherTokenAssetDataOrThrow(this._contractWrappers);
|
||||
return assetDataUtils.getEtherTokenAssetData(this._contractWrappers);
|
||||
}
|
||||
/**
|
||||
* Get the assetData that represents the ZRX token.
|
||||
* Will throw if ZRX does not exist for the current network.
|
||||
*/
|
||||
private _getZrxTokenAssetDataOrThrow(): string {
|
||||
return assetDataUtils.getZrxTokenAssetDataOrThrow(this._contractWrappers);
|
||||
return this._contractWrappers.exchange.getZRXAssetData();
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { BigNumber } from '@0xproject/utils';
|
||||
import { BigNumber } from '@0x/utils';
|
||||
|
||||
import { AssetBuyerOpts, BuyQuoteExecutionOpts, BuyQuoteRequestOpts } from './types';
|
||||
|
||||
@@ -8,7 +8,7 @@ const MAINNET_NETWORK_ID = 1;
|
||||
const DEFAULT_ASSET_BUYER_OPTS: AssetBuyerOpts = {
|
||||
networkId: MAINNET_NETWORK_ID,
|
||||
orderRefreshIntervalMs: 10000, // 10 seconds
|
||||
expiryBufferSeconds: 15,
|
||||
expiryBufferSeconds: 300, // 5 minutes
|
||||
};
|
||||
|
||||
const DEFAULT_BUY_QUOTE_REQUEST_OPTS: BuyQuoteRequestOpts = {
|
||||
|
@@ -1,6 +1,12 @@
|
||||
export { Provider } from 'ethereum-types';
|
||||
export { SignedOrder } from '@0xproject/types';
|
||||
export { BigNumber } from '@0xproject/utils';
|
||||
export {
|
||||
JSONRPCRequestPayload,
|
||||
JSONRPCResponsePayload,
|
||||
JSONRPCResponseError,
|
||||
JSONRPCErrorCallback,
|
||||
Provider,
|
||||
} from 'ethereum-types';
|
||||
export { SignedOrder } from '@0x/types';
|
||||
export { BigNumber } from '@0x/utils';
|
||||
|
||||
export { AssetBuyer } from './asset_buyer';
|
||||
export { BasicOrderProvider } from './order_providers/basic_order_provider';
|
||||
@@ -10,6 +16,7 @@ export {
|
||||
AssetBuyerOpts,
|
||||
BuyQuote,
|
||||
BuyQuoteExecutionOpts,
|
||||
BuyQuoteInfo,
|
||||
BuyQuoteRequestOpts,
|
||||
OrderProvider,
|
||||
OrderProviderRequest,
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { schemas } from '@0xproject/json-schemas';
|
||||
import { SignedOrder } from '@0xproject/types';
|
||||
import { schemas } from '@0x/json-schemas';
|
||||
import { SignedOrder } from '@0x/types';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { OrderProvider, OrderProviderRequest, OrderProviderResponse } from '../types';
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { HttpClient } from '@0xproject/connect';
|
||||
import { APIOrder, OrderbookResponse } from '@0xproject/types';
|
||||
import { HttpClient } from '@0x/connect';
|
||||
import { APIOrder, OrderbookResponse } from '@0x/types';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import {
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { SignedOrder } from '@0xproject/types';
|
||||
import { BigNumber } from '@0xproject/utils';
|
||||
import { SignedOrder } from '@0x/types';
|
||||
import { BigNumber } from '@0x/utils';
|
||||
|
||||
/**
|
||||
* makerAssetData: The assetData representing the desired makerAsset.
|
||||
@@ -77,18 +77,22 @@ export interface BuyQuoteRequestOpts {
|
||||
/**
|
||||
* ethAmount: The desired amount of eth to spend. Defaults to buyQuote.worstCaseQuoteInfo.totalEthAmount.
|
||||
* takerAddress: The address to perform the buy. Defaults to the first available address from the provider.
|
||||
* gasLimit: The amount of gas to send with a transaction (in Gwei). Defaults to an eth_estimateGas rpc call.
|
||||
* gasPrice: Gas price in Wei to use for a transaction
|
||||
* feeRecipient: The address where affiliate fees are sent. Defaults to null address (0x000...000).
|
||||
*/
|
||||
export interface BuyQuoteExecutionOpts {
|
||||
ethAmount?: BigNumber;
|
||||
takerAddress?: string;
|
||||
gasLimit?: number;
|
||||
gasPrice?: BigNumber;
|
||||
feeRecipient: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* networkId: The ethereum network id. Defaults to 1 (mainnet).
|
||||
* orderRefreshIntervalMs: The interval in ms that getBuyQuoteAsync should trigger an refresh of orders and order states. Defaults to 10000ms (10s).
|
||||
* expiryBufferSeconds: The number of seconds to add when calculating whether an order is expired or not. Defaults to 15s.
|
||||
* expiryBufferSeconds: The number of seconds to add when calculating whether an order is expired or not. Defaults to 300s (5m).
|
||||
*/
|
||||
export interface AssetBuyerOpts {
|
||||
networkId: number;
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import { assert as sharedAssert } from '@0xproject/assert';
|
||||
import { schemas } from '@0xproject/json-schemas';
|
||||
import { SignedOrder } from '@0xproject/types';
|
||||
import { assert as sharedAssert } from '@0x/assert';
|
||||
import { schemas } from '@0x/json-schemas';
|
||||
import { SignedOrder } from '@0x/types';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { BuyQuote, BuyQuoteInfo, OrderProvider, OrderProviderRequest } from '../types';
|
||||
|
@@ -1,26 +1,12 @@
|
||||
import { ContractWrappers } from '@0xproject/contract-wrappers';
|
||||
import { assetDataUtils as sharedAssetDataUtils } from '@0xproject/order-utils';
|
||||
import { ContractWrappers } from '@0x/contract-wrappers';
|
||||
import { assetDataUtils as sharedAssetDataUtils } from '@0x/order-utils';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { AssetBuyerError } from '../types';
|
||||
|
||||
export const assetDataUtils = {
|
||||
...sharedAssetDataUtils,
|
||||
getEtherTokenAssetDataOrThrow(contractWrappers: ContractWrappers): string {
|
||||
const etherTokenAddressIfExists = contractWrappers.etherToken.getContractAddressIfExists();
|
||||
if (_.isUndefined(etherTokenAddressIfExists)) {
|
||||
throw new Error(AssetBuyerError.NoEtherTokenContractFound);
|
||||
}
|
||||
const etherTokenAssetData = sharedAssetDataUtils.encodeERC20AssetData(etherTokenAddressIfExists);
|
||||
getEtherTokenAssetData(contractWrappers: ContractWrappers): string {
|
||||
const etherTokenAddress = contractWrappers.forwarder.etherTokenAddress;
|
||||
const etherTokenAssetData = sharedAssetDataUtils.encodeERC20AssetData(etherTokenAddress);
|
||||
return etherTokenAssetData;
|
||||
},
|
||||
getZrxTokenAssetDataOrThrow(contractWrappers: ContractWrappers): string {
|
||||
let zrxTokenAssetData: string;
|
||||
try {
|
||||
zrxTokenAssetData = contractWrappers.exchange.getZRXAssetData();
|
||||
} catch (err) {
|
||||
throw new Error(AssetBuyerError.NoZrxTokenContractFound);
|
||||
}
|
||||
return zrxTokenAssetData;
|
||||
},
|
||||
};
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { marketUtils, rateUtils } from '@0xproject/order-utils';
|
||||
import { BigNumber } from '@0xproject/utils';
|
||||
import { marketUtils, rateUtils } from '@0x/order-utils';
|
||||
import { BigNumber } from '@0x/utils';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { constants } from '../constants';
|
||||
@@ -72,7 +72,6 @@ export const buyQuoteCalculator = {
|
||||
assetBuyAmount,
|
||||
feePercentage,
|
||||
);
|
||||
|
||||
return {
|
||||
assetData,
|
||||
orders: resultOrders,
|
||||
@@ -98,13 +97,14 @@ function calculateQuoteInfo(
|
||||
);
|
||||
// find the total eth needed to buy fees
|
||||
const ethAmountToBuyFees = findEthAmountNeededToBuyFees(feeOrdersAndFillableAmounts, zrxAmountToBuyAsset);
|
||||
const ethAmountBeforeAffiliateFee = ethAmountToBuyAsset.plus(ethAmountToBuyFees);
|
||||
const totalEthAmount = ethAmountBeforeAffiliateFee.mul(feePercentage + 1);
|
||||
const affiliateFeeEthAmount = ethAmountToBuyAsset.mul(feePercentage);
|
||||
const totalEthAmountWithoutAffiliateFee = ethAmountToBuyAsset.plus(ethAmountToBuyFees);
|
||||
const totalEthAmount = totalEthAmountWithoutAffiliateFee.plus(affiliateFeeEthAmount);
|
||||
// divide into the assetBuyAmount in order to find rate of makerAsset / WETH
|
||||
const ethPerAssetPrice = ethAmountBeforeAffiliateFee.div(assetBuyAmount);
|
||||
const ethPerAssetPrice = totalEthAmountWithoutAffiliateFee.div(assetBuyAmount);
|
||||
return {
|
||||
totalEthAmount,
|
||||
feeEthAmount: totalEthAmount.minus(ethAmountBeforeAffiliateFee),
|
||||
feeEthAmount: affiliateFeeEthAmount,
|
||||
ethPerAssetPrice,
|
||||
};
|
||||
}
|
||||
|
@@ -1,8 +1,8 @@
|
||||
import { OrderAndTraderInfo, OrderStatus, OrderValidatorWrapper } from '@0xproject/contract-wrappers';
|
||||
import { sortingUtils } from '@0xproject/order-utils';
|
||||
import { RemainingFillableCalculator } from '@0xproject/order-utils/lib/src/remaining_fillable_calculator';
|
||||
import { SignedOrder } from '@0xproject/types';
|
||||
import { BigNumber } from '@0xproject/utils';
|
||||
import { OrderAndTraderInfo, OrderStatus, OrderValidatorWrapper } from '@0x/contract-wrappers';
|
||||
import { sortingUtils } from '@0x/order-utils';
|
||||
import { RemainingFillableCalculator } from '@0x/order-utils/lib/src/remaining_fillable_calculator';
|
||||
import { SignedOrder } from '@0x/types';
|
||||
import { BigNumber } from '@0x/utils';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { constants } from '../constants';
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { SignedOrder } from '@0xproject/types';
|
||||
import { BigNumber } from '@0xproject/utils';
|
||||
import { SignedOrder } from '@0x/types';
|
||||
import { BigNumber } from '@0x/utils';
|
||||
|
||||
import { constants } from '../constants';
|
||||
|
||||
@@ -10,7 +10,7 @@ export const orderUtils = {
|
||||
willOrderExpire(order: SignedOrder, secondsFromNow: number): boolean {
|
||||
const millisecondsInSecond = 1000;
|
||||
const currentUnixTimestampSec = new BigNumber(Date.now() / millisecondsInSecond).round();
|
||||
return order.expirationTimeSeconds.lessThan(currentUnixTimestampSec.minus(secondsFromNow));
|
||||
return order.expirationTimeSeconds.lessThan(currentUnixTimestampSec.plus(secondsFromNow));
|
||||
},
|
||||
calculateRemainingMakerAssetAmount(order: SignedOrder, remainingTakerAssetAmount: BigNumber): BigNumber {
|
||||
if (remainingTakerAssetAmount.eq(0)) {
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { orderFactory } from '@0xproject/order-utils/lib/src/order_factory';
|
||||
import { BigNumber } from '@0xproject/utils';
|
||||
import { orderFactory } from '@0x/order-utils/lib/src/order_factory';
|
||||
import { BigNumber } from '@0x/utils';
|
||||
import * as chai from 'chai';
|
||||
import * as _ from 'lodash';
|
||||
import 'mocha';
|
||||
@@ -103,9 +103,11 @@ describe('buyQuoteCalculator', () => {
|
||||
expect(buyQuote.feeOrders).to.deep.equal([smallFeeOrderAndFillableAmount.orders[0]]);
|
||||
// test if rates are correct
|
||||
// 50 eth to fill the first order + 100 eth for fees
|
||||
const expectedFillEthAmount = new BigNumber(150);
|
||||
const expectedTotalEthAmount = expectedFillEthAmount.mul(feePercentage + 1);
|
||||
const expectedFeeEthAmount = expectedTotalEthAmount.minus(expectedFillEthAmount);
|
||||
const expectedEthAmountForAsset = new BigNumber(50);
|
||||
const expectedEthAmountForZrxFees = new BigNumber(100);
|
||||
const expectedFillEthAmount = expectedEthAmountForAsset.plus(expectedEthAmountForZrxFees);
|
||||
const expectedFeeEthAmount = expectedEthAmountForAsset.mul(feePercentage);
|
||||
const expectedTotalEthAmount = expectedFillEthAmount.plus(expectedFeeEthAmount);
|
||||
const expectedEthPerAssetPrice = expectedFillEthAmount.div(assetBuyAmount);
|
||||
expect(buyQuote.bestCaseQuoteInfo.feeEthAmount).to.bignumber.equal(expectedFeeEthAmount);
|
||||
expect(buyQuote.bestCaseQuoteInfo.totalEthAmount).to.bignumber.equal(expectedTotalEthAmount);
|
||||
@@ -138,17 +140,21 @@ describe('buyQuoteCalculator', () => {
|
||||
expect(buyQuote.feeOrders).to.deep.equal(allFeeOrdersAndFillableAmounts.orders);
|
||||
// test if rates are correct
|
||||
// 50 eth to fill the first order + 100 eth for fees
|
||||
const expectedFillEthAmount = new BigNumber(150);
|
||||
const expectedTotalEthAmount = expectedFillEthAmount.mul(feePercentage + 1);
|
||||
const expectedFeeEthAmount = expectedTotalEthAmount.minus(expectedFillEthAmount);
|
||||
const expectedEthAmountForAsset = new BigNumber(50);
|
||||
const expectedEthAmountForZrxFees = new BigNumber(100);
|
||||
const expectedFillEthAmount = expectedEthAmountForAsset.plus(expectedEthAmountForZrxFees);
|
||||
const expectedFeeEthAmount = expectedEthAmountForAsset.mul(feePercentage);
|
||||
const expectedTotalEthAmount = expectedFillEthAmount.plus(expectedFeeEthAmount);
|
||||
const expectedEthPerAssetPrice = expectedFillEthAmount.div(assetBuyAmount);
|
||||
expect(buyQuote.bestCaseQuoteInfo.feeEthAmount).to.bignumber.equal(expectedFeeEthAmount);
|
||||
expect(buyQuote.bestCaseQuoteInfo.totalEthAmount).to.bignumber.equal(expectedTotalEthAmount);
|
||||
expect(buyQuote.bestCaseQuoteInfo.ethPerAssetPrice).to.bignumber.equal(expectedEthPerAssetPrice);
|
||||
// 100 eth to fill the first order + 200 eth for fees
|
||||
const expectedWorstFillEthAmount = new BigNumber(300);
|
||||
const expectedWorstTotalEthAmount = expectedWorstFillEthAmount.mul(feePercentage + 1);
|
||||
const expectedWorstFeeEthAmount = expectedWorstTotalEthAmount.minus(expectedWorstFillEthAmount);
|
||||
const expectedWorstEthAmountForAsset = new BigNumber(100);
|
||||
const expectedWorstEthAmountForZrxFees = new BigNumber(200);
|
||||
const expectedWorstFillEthAmount = expectedWorstEthAmountForAsset.plus(expectedWorstEthAmountForZrxFees);
|
||||
const expectedWorstFeeEthAmount = expectedWorstEthAmountForAsset.mul(feePercentage);
|
||||
const expectedWorstTotalEthAmount = expectedWorstFillEthAmount.plus(expectedWorstFeeEthAmount);
|
||||
const expectedWorstEthPerAssetPrice = expectedWorstFillEthAmount.div(assetBuyAmount);
|
||||
expect(buyQuote.worstCaseQuoteInfo.feeEthAmount).to.bignumber.equal(expectedWorstFeeEthAmount);
|
||||
expect(buyQuote.worstCaseQuoteInfo.totalEthAmount).to.bignumber.equal(expectedWorstTotalEthAmount);
|
||||
|
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"extends": ["@0xproject/tslint-config"]
|
||||
"extends": ["@0x/tslint-config"]
|
||||
}
|
||||
|
@@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1539871071,
|
||||
"version": "3.0.2",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "3.0.1",
|
||||
"changes": [
|
||||
|
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v3.0.2 - _October 18, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v3.0.1 - _October 4, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
@@ -38,7 +42,7 @@ CHANGELOG
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v2.0.0-rc.1 - _August 13, 2018_
|
||||
## v2.0.0-rc.1 - _August 14, 2018_
|
||||
|
||||
* Added strict encoding/decoding checks for sendTransaction and call (#915)
|
||||
|
||||
|
@@ -1,25 +1,25 @@
|
||||
## @0xproject/base-contract
|
||||
## @0x/base-contract
|
||||
|
||||
BaseContract to derive all auto-generated wrappers from
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
yarn add @0xproject/base-contract
|
||||
yarn add @0x/base-contract
|
||||
```
|
||||
|
||||
If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`:
|
||||
|
||||
```json
|
||||
"compilerOptions": {
|
||||
"typeRoots": ["node_modules/@0xproject/typescript-typings/types", "node_modules/@types"],
|
||||
"typeRoots": ["node_modules/@0x/typescript-typings/types", "node_modules/@types"],
|
||||
}
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```javascript
|
||||
import { BaseContract } from '@0xproject/base-contract';
|
||||
import { BaseContract } from '@0x/base-contract';
|
||||
```
|
||||
|
||||
## Contributing
|
||||
@@ -47,13 +47,13 @@ yarn install
|
||||
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
|
||||
|
||||
```bash
|
||||
PKG=@0xproject/base-contract yarn build
|
||||
PKG=@0x/base-contract yarn build
|
||||
```
|
||||
|
||||
Or continuously rebuild on change:
|
||||
|
||||
```bash
|
||||
PKG=@0xproject/base-contract yarn watch
|
||||
PKG=@0x/base-contract yarn watch
|
||||
```
|
||||
|
||||
### Lint
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0xproject/base-contract",
|
||||
"version": "3.0.1",
|
||||
"name": "@0x/base-contract",
|
||||
"version": "3.0.2",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -29,10 +29,9 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/0x-monorepo/packages/base-contract/README.md",
|
||||
"devDependencies": {
|
||||
"@0xproject/tslint-config": "^1.0.8",
|
||||
"@0x/tslint-config": "^1.0.9",
|
||||
"@types/lodash": "4.14.104",
|
||||
"chai": "^4.0.1",
|
||||
"copyfiles": "^2.0.0",
|
||||
"make-promises-safe": "^1.1.0",
|
||||
"mocha": "^4.1.0",
|
||||
"npm-run-all": "^4.1.2",
|
||||
@@ -41,11 +40,11 @@
|
||||
"typescript": "3.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0xproject/typescript-typings": "^3.0.2",
|
||||
"@0xproject/utils": "^2.0.2",
|
||||
"@0xproject/web3-wrapper": "^3.0.3",
|
||||
"ethereum-types": "^1.0.11",
|
||||
"ethers": "4.0.0-beta.14",
|
||||
"@0x/typescript-typings": "^3.0.3",
|
||||
"@0x/utils": "^2.0.3",
|
||||
"@0x/web3-wrapper": "^3.1.0",
|
||||
"ethereum-types": "^1.1.1",
|
||||
"ethers": "~4.0.4",
|
||||
"lodash": "^4.17.5"
|
||||
},
|
||||
"publishConfig": {
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { abiUtils, BigNumber } from '@0xproject/utils';
|
||||
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||
import { abiUtils, BigNumber } from '@0x/utils';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import {
|
||||
AbiDefinition,
|
||||
AbiType,
|
||||
@@ -17,7 +17,7 @@ import * as _ from 'lodash';
|
||||
import { formatABIDataItem } from './utils';
|
||||
|
||||
export interface EthersInterfaceByFunctionSignature {
|
||||
[key: string]: ethers.Interface;
|
||||
[key: string]: ethers.utils.Interface;
|
||||
}
|
||||
|
||||
const REVERT_ERROR_SELECTOR = '08c379a0';
|
||||
@@ -101,7 +101,7 @@ export class BaseContract {
|
||||
// if it overflows the corresponding Solidity type, there is a bug in the
|
||||
// encoder, or the encoder performs unsafe type coercion.
|
||||
public static strictArgumentEncodingCheck(inputAbi: DataItem[], args: any[]): void {
|
||||
const coder = new ethers.AbiCoder();
|
||||
const coder = new ethers.utils.AbiCoder();
|
||||
const params = abiUtils.parseEthersParams(inputAbi);
|
||||
const rawEncoded = coder.encode(inputAbi, args);
|
||||
const rawDecoded = coder.decode(inputAbi, rawEncoded);
|
||||
@@ -117,7 +117,7 @@ export class BaseContract {
|
||||
}
|
||||
}
|
||||
}
|
||||
protected _lookupEthersInterface(functionSignature: string): ethers.Interface {
|
||||
protected _lookupEthersInterface(functionSignature: string): ethers.utils.Interface {
|
||||
const ethersInterface = this._ethersInterfacesByFunctionSignature[functionSignature];
|
||||
if (_.isUndefined(ethersInterface)) {
|
||||
throw new Error(`Failed to lookup method with function signature '${functionSignature}'`);
|
||||
@@ -129,7 +129,8 @@ export class BaseContract {
|
||||
if (abiDefinition.type !== AbiType.Function) {
|
||||
return false;
|
||||
}
|
||||
const abiFunctionSignature = abiUtils.getFunctionSignature(abiDefinition);
|
||||
// tslint:disable-next-line:no-unnecessary-type-assertion
|
||||
const abiFunctionSignature = abiUtils.getFunctionSignature(abiDefinition as MethodAbi);
|
||||
if (abiFunctionSignature === functionSignature) {
|
||||
return true;
|
||||
}
|
||||
@@ -154,7 +155,7 @@ export class BaseContract {
|
||||
this._ethersInterfacesByFunctionSignature = {};
|
||||
_.each(methodAbis, methodAbi => {
|
||||
const functionSignature = abiUtils.getFunctionSignature(methodAbi);
|
||||
this._ethersInterfacesByFunctionSignature[functionSignature] = new ethers.Interface([methodAbi]);
|
||||
this._ethersInterfacesByFunctionSignature[functionSignature] = new ethers.utils.Interface([methodAbi]);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { BigNumber } from '@0xproject/utils';
|
||||
import { BigNumber } from '@0x/utils';
|
||||
import * as chai from 'chai';
|
||||
import 'mocha';
|
||||
|
||||
|
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"extends": ["@0xproject/tslint-config"]
|
||||
"extends": ["@0x/tslint-config"]
|
||||
}
|
||||
|
@@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1539871071,
|
||||
"version": "3.0.2",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "3.0.1",
|
||||
"changes": [
|
||||
|
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v3.0.2 - _October 18, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v3.0.1 - _October 4, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
@@ -42,7 +46,7 @@ CHANGELOG
|
||||
* Updated for SRA v2 (#974)
|
||||
* Stopped exporting `Order` type (#924)
|
||||
|
||||
## v1.0.5 - _August 13, 2018_
|
||||
## v1.0.5 - _August 14, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
|
@@ -1,18 +1,18 @@
|
||||
## @0xproject/connect
|
||||
## @0x/connect
|
||||
|
||||
This repository contains a Javascript library that makes it easy to interact with Relayers that conform to the [Standard Relayer API](https://github.com/0xProject/standard-relayer-api)
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
yarn add @0xproject/connect
|
||||
yarn add @0x/connect
|
||||
```
|
||||
|
||||
If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`:
|
||||
|
||||
```json
|
||||
"compilerOptions": {
|
||||
"typeRoots": ["node_modules/@0xproject/typescript-typings/types", "node_modules/@types"],
|
||||
"typeRoots": ["node_modules/@0x/typescript-typings/types", "node_modules/@types"],
|
||||
}
|
||||
```
|
||||
|
||||
@@ -46,13 +46,13 @@ yarn install
|
||||
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
|
||||
|
||||
```bash
|
||||
PKG=@0xproject/connect yarn build
|
||||
PKG=@0x/connect yarn build
|
||||
```
|
||||
|
||||
Or continuously rebuild on change:
|
||||
|
||||
```bash
|
||||
PKG=@0xproject/connect yarn watch
|
||||
PKG=@0x/connect yarn watch
|
||||
```
|
||||
|
||||
### Clean
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0xproject/connect",
|
||||
"version": "3.0.1",
|
||||
"name": "@0x/connect",
|
||||
"version": "3.0.2",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -44,12 +44,12 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/0x-monorepo/packages/connect/README.md",
|
||||
"dependencies": {
|
||||
"@0xproject/assert": "^1.0.13",
|
||||
"@0xproject/json-schemas": "^1.0.7",
|
||||
"@0xproject/order-utils": "^1.0.7",
|
||||
"@0xproject/types": "^1.1.4",
|
||||
"@0xproject/typescript-typings": "^3.0.2",
|
||||
"@0xproject/utils": "^2.0.2",
|
||||
"@0x/assert": "^1.0.14",
|
||||
"@0x/json-schemas": "^2.0.0",
|
||||
"@0x/order-utils": "^2.0.0",
|
||||
"@0x/types": "^1.2.0",
|
||||
"@0x/typescript-typings": "^3.0.3",
|
||||
"@0x/utils": "^2.0.3",
|
||||
"lodash": "^4.17.5",
|
||||
"query-string": "^5.0.1",
|
||||
"sinon": "^4.0.0",
|
||||
@@ -57,7 +57,7 @@
|
||||
"websocket": "^1.0.25"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@0xproject/tslint-config": "^1.0.8",
|
||||
"@0x/tslint-config": "^1.0.9",
|
||||
"@types/fetch-mock": "^6.0.3",
|
||||
"@types/lodash": "4.14.104",
|
||||
"@types/mocha": "^2.2.42",
|
||||
@@ -77,7 +77,7 @@
|
||||
"nyc": "^11.0.1",
|
||||
"shx": "^0.2.2",
|
||||
"tslint": "5.11.0",
|
||||
"typedoc": "0.12.0",
|
||||
"typedoc": "0.13.0",
|
||||
"typescript": "3.0.1"
|
||||
},
|
||||
"publishConfig": {
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { assert } from '@0xproject/assert';
|
||||
import { schemas } from '@0xproject/json-schemas';
|
||||
import { assert } from '@0x/assert';
|
||||
import { schemas } from '@0x/json-schemas';
|
||||
import {
|
||||
APIOrder,
|
||||
AssetPairsRequestOpts,
|
||||
@@ -14,8 +14,8 @@ import {
|
||||
PagedRequestOpts,
|
||||
RequestOpts,
|
||||
SignedOrder,
|
||||
} from '@0xproject/types';
|
||||
import { fetchAsync } from '@0xproject/utils';
|
||||
} from '@0x/types';
|
||||
import { fetchAsync } from '@0x/utils';
|
||||
import * as _ from 'lodash';
|
||||
import * as queryString from 'query-string';
|
||||
|
||||
|
@@ -17,4 +17,4 @@ export {
|
||||
PaginatedCollection,
|
||||
RequestOpts,
|
||||
SignedOrder,
|
||||
} from '@0xproject/types';
|
||||
} from '@0x/types';
|
||||
|
@@ -12,7 +12,7 @@ import {
|
||||
PagedRequestOpts,
|
||||
PaginatedCollection,
|
||||
SignedOrder,
|
||||
} from '@0xproject/types';
|
||||
} from '@0x/types';
|
||||
|
||||
export interface Client {
|
||||
getAssetPairsAsync: (
|
||||
|
@@ -1,11 +1,11 @@
|
||||
import { assert as sharedAssert } from '@0xproject/assert';
|
||||
import { assert as sharedAssert } from '@0x/assert';
|
||||
// HACK: We need those two unused imports because they're actually used by sharedAssert which gets injected here
|
||||
// tslint:disable-next-line:no-unused-variable
|
||||
import { Schema, schemas } from '@0xproject/json-schemas';
|
||||
import { Schema, schemas } from '@0x/json-schemas';
|
||||
// tslint:disable-next-line:no-unused-variable
|
||||
import { ECSignature } from '@0xproject/types';
|
||||
import { ECSignature } from '@0x/types';
|
||||
// tslint:disable-next-line:no-unused-variable
|
||||
import { BigNumber } from '@0xproject/utils';
|
||||
import { BigNumber } from '@0x/utils';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
export const assert = {
|
||||
@@ -14,7 +14,7 @@ export const assert = {
|
||||
sharedAssert.doesConformToSchema(
|
||||
variableName,
|
||||
subscriptionOpts,
|
||||
schemas.relayerApiOrdersChannelSubscribePayload,
|
||||
schemas.relayerApiOrdersChannelSubscribePayloadSchema,
|
||||
);
|
||||
},
|
||||
isOrdersChannelHandler(variableName: string, handler: any): void {
|
||||
|
@@ -1,8 +1,8 @@
|
||||
import { assert } from '@0xproject/assert';
|
||||
import { schemas } from '@0xproject/json-schemas';
|
||||
import { assert } from '@0x/assert';
|
||||
import { schemas } from '@0x/json-schemas';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { OrdersChannelMessage, OrdersChannelMessageTypes } from '@0xproject/types';
|
||||
import { OrdersChannelMessage, OrdersChannelMessageTypes } from '@0x/types';
|
||||
|
||||
import { relayerResponseJsonParsers } from './relayer_response_json_parsers';
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import { assert } from '@0xproject/assert';
|
||||
import { schemas } from '@0xproject/json-schemas';
|
||||
import { orderParsingUtils } from '@0xproject/order-utils';
|
||||
import { assert } from '@0x/assert';
|
||||
import { schemas } from '@0x/json-schemas';
|
||||
import { orderParsingUtils } from '@0x/order-utils';
|
||||
|
||||
import {
|
||||
APIOrder,
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
OrderbookResponse,
|
||||
OrderConfigResponse,
|
||||
OrdersResponse,
|
||||
} from '@0xproject/types';
|
||||
} from '@0x/types';
|
||||
|
||||
import { typeConverters } from './type_converters';
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import { orderParsingUtils } from '@0xproject/order-utils';
|
||||
import { orderParsingUtils } from '@0x/order-utils';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { APIOrder } from '@0xproject/types';
|
||||
import { APIOrder } from '@0x/types';
|
||||
|
||||
export const typeConverters = {
|
||||
convertOrderbookStringFieldsToBigNumber(orderbook: any): any {
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { OrdersChannelMessageTypes, OrdersChannelSubscriptionOpts } from '@0xproject/types';
|
||||
import { OrdersChannelMessageTypes, OrdersChannelSubscriptionOpts } from '@0x/types';
|
||||
import * as _ from 'lodash';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
import * as WebSocket from 'websocket';
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import { BigNumber } from '@0xproject/utils';
|
||||
import { BigNumber } from '@0x/utils';
|
||||
|
||||
import { AssetPairsResponse } from '@0xproject/types';
|
||||
import { AssetPairsResponse } from '@0x/types';
|
||||
|
||||
export const assetDataPairsResponse: AssetPairsResponse = {
|
||||
total: 43,
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { FeeRecipientsResponse } from '@0xproject/types';
|
||||
import { FeeRecipientsResponse } from '@0x/types';
|
||||
|
||||
export const feeRecipientsResponse: FeeRecipientsResponse = {
|
||||
total: 3,
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { BigNumber } from '@0xproject/utils';
|
||||
import { BigNumber } from '@0x/utils';
|
||||
|
||||
export const orderResponse = {
|
||||
order: {
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import { BigNumber } from '@0xproject/utils';
|
||||
import { BigNumber } from '@0x/utils';
|
||||
|
||||
import { OrderConfigResponse } from '@0xproject/types';
|
||||
import { OrderConfigResponse } from '@0x/types';
|
||||
|
||||
export const orderConfigResponse: OrderConfigResponse = {
|
||||
senderAddress: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32',
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import { BigNumber } from '@0xproject/utils';
|
||||
import { BigNumber } from '@0x/utils';
|
||||
|
||||
import { OrderbookResponse } from '@0xproject/types';
|
||||
import { OrderbookResponse } from '@0x/types';
|
||||
|
||||
export const orderbookResponse: OrderbookResponse = {
|
||||
bids: {
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import { BigNumber } from '@0xproject/utils';
|
||||
import { BigNumber } from '@0x/utils';
|
||||
|
||||
import { OrdersResponse } from '@0xproject/types';
|
||||
import { OrdersResponse } from '@0x/types';
|
||||
|
||||
export const ordersResponse: OrdersResponse = {
|
||||
total: 984,
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { BigNumber } from '@0xproject/utils';
|
||||
import { BigNumber } from '@0x/utils';
|
||||
import * as chai from 'chai';
|
||||
import * as chaiAsPromised from 'chai-as-promised';
|
||||
import * as dirtyChai from 'dirty-chai';
|
||||
|
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"extends": ["@0xproject/tslint-config"]
|
||||
"extends": ["@0x/tslint-config"]
|
||||
}
|
||||
|
20
packages/contract-addresses/CHANGELOG.json
Normal file
20
packages/contract-addresses/CHANGELOG.json
Normal file
@@ -0,0 +1,20 @@
|
||||
[
|
||||
{
|
||||
"version": "1.0.1",
|
||||
"changes": [
|
||||
{
|
||||
"pr": 1105,
|
||||
"note": "Initial release"
|
||||
}
|
||||
],
|
||||
"timestamp": 1539871071
|
||||
},
|
||||
{
|
||||
"version": "1.0.0",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Unpublished Package"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
14
packages/contract-addresses/CHANGELOG.md
Normal file
14
packages/contract-addresses/CHANGELOG.md
Normal file
@@ -0,0 +1,14 @@
|
||||
<!--
|
||||
changelogUtils.file is auto-generated using the monorepo-scripts package. Don't edit directly.
|
||||
Edit the package's CHANGELOG.json file only.
|
||||
-->
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v1.0.1 - _October 18, 2018_
|
||||
|
||||
* Initial release (#1105)
|
||||
|
||||
## v1.0.0 - _Invalid date_
|
||||
|
||||
* Unpublished Package
|
68
packages/contract-addresses/README.md
Normal file
68
packages/contract-addresses/README.md
Normal file
@@ -0,0 +1,68 @@
|
||||
## @0x/contract-addresses
|
||||
|
||||
A tiny utility library for getting known deployed contract addresses for a
|
||||
particular network.
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
yarn add @0x/contract-addresses
|
||||
```
|
||||
|
||||
**Import**
|
||||
|
||||
```typescript
|
||||
import { getContractAddressesForNetworkOrThrow } from '@0x/contract-addresses';
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```javascript
|
||||
var getContractAddressesForNetworkOrThrow = require('@0x/contract-addresses').getContractAddressesForNetworkOrThrow;
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
We welcome improvements and fixes from the wider community! To report bugs within this package, please create an issue in this repository.
|
||||
|
||||
Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
|
||||
|
||||
### Install dependencies
|
||||
|
||||
If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
|
||||
|
||||
```bash
|
||||
yarn config set workspaces-experimental true
|
||||
```
|
||||
|
||||
Then install dependencies
|
||||
|
||||
```bash
|
||||
yarn install
|
||||
```
|
||||
|
||||
### Build
|
||||
|
||||
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
|
||||
|
||||
```bash
|
||||
PKG=@0x/contract-addresses yarn build
|
||||
```
|
||||
|
||||
### Clean
|
||||
|
||||
```bash
|
||||
yarn clean
|
||||
```
|
||||
|
||||
### Lint
|
||||
|
||||
```bash
|
||||
yarn lint
|
||||
```
|
||||
|
||||
### Run Tests
|
||||
|
||||
```bash
|
||||
yarn test
|
||||
```
|
37
packages/contract-addresses/package.json
Normal file
37
packages/contract-addresses/package.json
Normal file
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"name": "@0x/contract-addresses",
|
||||
"version": "1.0.1",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
"description": "Used to get known addresses of deployed 0x contracts",
|
||||
"main": "lib/src/index.js",
|
||||
"directories": {
|
||||
"test": "test"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "yarn tsc -b",
|
||||
"build:ci": "yarn build",
|
||||
"clean": "shx rm -rf lib"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/0xProject/0x-monorepo.git"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"bugs": {
|
||||
"url": "https://github.com/0xProject/0x-monorepo/issues"
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/0x-monorepo/packages/contract-addresses/README.md",
|
||||
"devDependencies": {
|
||||
"@types/lodash": "4.14.104",
|
||||
"shx": "^0.2.2",
|
||||
"typescript": "3.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"lodash": "^4.17.5"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
}
|
||||
}
|
66
packages/contract-addresses/src/index.ts
Normal file
66
packages/contract-addresses/src/index.ts
Normal file
@@ -0,0 +1,66 @@
|
||||
import * as _ from 'lodash';
|
||||
|
||||
export interface ContractAddresses {
|
||||
erc20Proxy: string;
|
||||
erc721Proxy: string;
|
||||
zrxToken: string;
|
||||
etherToken: string;
|
||||
exchange: string;
|
||||
assetProxyOwner: string;
|
||||
forwarder: string;
|
||||
orderValidator: string;
|
||||
}
|
||||
|
||||
export enum NetworkId {
|
||||
Mainnet = 1,
|
||||
Ropsten = 3,
|
||||
Kovan = 42,
|
||||
}
|
||||
|
||||
const networkToAddresses: { [networkId: number]: ContractAddresses } = {
|
||||
1: {
|
||||
erc20Proxy: '0x2240dab907db71e64d3e0dba4800c83b5c502d4e',
|
||||
erc721Proxy: '0x208e41fb445f1bb1b6780d58356e81405f3e6127',
|
||||
zrxToken: '0xe41d2489571d322189246dafa5ebde1f4699f498',
|
||||
etherToken: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
||||
exchange: '0x4f833a24e1f95d70f028921e27040ca56e09ab0b',
|
||||
assetProxyOwner: '0x17992e4ffb22730138e4b62aaa6367fa9d3699a6',
|
||||
forwarder: '0x7afc2d5107af94c462a194d2c21b5bdd238709d6',
|
||||
orderValidator: '0x9463e518dea6810309563c81d5266c1b1d149138',
|
||||
},
|
||||
3: {
|
||||
erc20Proxy: '0xb1408f4c245a23c31b98d2c626777d4c0d766caa',
|
||||
erc721Proxy: '0xe654aac058bfbf9f83fcaee7793311dd82f6ddb4',
|
||||
zrxToken: '0xff67881f8d12f372d91baae9752eb3631ff0ed00',
|
||||
etherToken: '0xc778417e063141139fce010982780140aa0cd5ab',
|
||||
exchange: '0x4530c0483a1633c7a1c97d2c53721caff2caaaaf',
|
||||
assetProxyOwner: '0xf5fa5b5fed2727a0e44ac67f6772e97977aa358b',
|
||||
forwarder: '0x3983e204b12b3c02fb0638caf2cd406a62e0ead3',
|
||||
orderValidator: '0x90431a90516ab49af23a0530e04e8c7836e7122f',
|
||||
},
|
||||
42: {
|
||||
erc20Proxy: '0xf1ec01d6236d3cd881a0bf0130ea25fe4234003e',
|
||||
erc721Proxy: '0x2a9127c745688a165106c11cd4d647d2220af821',
|
||||
zrxToken: '0x2002d3812f58e35f0ea1ffbf80a75a38c32175fa',
|
||||
etherToken: '0xd0a1e359811322d97991e03f863a0c30c2cf029c',
|
||||
exchange: '0x35dd2932454449b14cee11a94d3674a936d5d7b2',
|
||||
assetProxyOwner: '0x2c824d2882baa668e0d5202b1e7f2922278703f8',
|
||||
forwarder: '0xd85e2fa7e7e252b27b01bf0d65c946959d2f45b8',
|
||||
orderValidator: '0xb389da3d204b412df2f75c6afb3d0a7ce0bc283d',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Used to get addresses of contracts that have been deployed to either the
|
||||
* Ethereum mainnet or a supported testnet. Throws if there are no known
|
||||
* contracts deployed on the corresponding network.
|
||||
* @param networkId The desired networkId.
|
||||
* @returns The set of addresses for contracts which have been deployed on the
|
||||
* given networkId.
|
||||
*/
|
||||
export function getContractAddressesForNetworkOrThrow(networkId: NetworkId): ContractAddresses {
|
||||
if (_.isUndefined(networkToAddresses[networkId])) {
|
||||
throw new Error(`Unknown network id (${networkId}). No known 0x contracts have been deployed on this network.`);
|
||||
}
|
||||
return networkToAddresses[networkId];
|
||||
}
|
8
packages/contract-addresses/tsconfig.json
Normal file
8
packages/contract-addresses/tsconfig.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "../../tsconfig",
|
||||
"compilerOptions": {
|
||||
"outDir": "lib",
|
||||
"rootDir": "."
|
||||
},
|
||||
"include": ["./src/**/*"]
|
||||
}
|
3
packages/contract-addresses/tslint.json
Normal file
3
packages/contract-addresses/tslint.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": ["@0x/tslint-config"]
|
||||
}
|
20
packages/contract-artifacts/CHANGELOG.json
Normal file
20
packages/contract-artifacts/CHANGELOG.json
Normal file
@@ -0,0 +1,20 @@
|
||||
[
|
||||
{
|
||||
"version": "1.0.1",
|
||||
"changes": [
|
||||
{
|
||||
"pr": 1105,
|
||||
"note": "Initial release"
|
||||
}
|
||||
],
|
||||
"timestamp": 1539871071
|
||||
},
|
||||
{
|
||||
"version": "1.0.0",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Unpublished Package"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user