Change all instances of networkId
to chainId
(#2313)
* abi-gen/test: recompile contract fixtures for 3.0 It seems this hadn't been done since the merge with the 3.0 branch. * Sync `monorepo$ yarn test` exclusions to CI config * sra-spec: correct typo * contract-wrappers: TODO after coord.-server update * utils: fix typo in comment * Refactor networkId to chainId everywhere * Update CHANGELOGs
This commit is contained in:
parent
e61f23d001
commit
f51c80adb2
@ -78,7 +78,9 @@ jobs:
|
|||||||
keys:
|
keys:
|
||||||
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
||||||
- run: yarn wsrun test:circleci @0x/contracts-multisig @0x/contracts-utils @0x/contracts-exchange-libs @0x/contracts-erc20 @0x/contracts-erc721 @0x/contracts-erc1155 @0x/contracts-asset-proxy @0x/contracts-exchange-forwarder @0x/contracts-tests @0x/contracts-staking @0x/contracts-coordinator
|
- run: yarn wsrun test:circleci @0x/contracts-multisig @0x/contracts-utils @0x/contracts-exchange-libs @0x/contracts-erc20 @0x/contracts-erc721 @0x/contracts-erc1155 @0x/contracts-asset-proxy @0x/contracts-exchange-forwarder @0x/contracts-tests @0x/contracts-staking @0x/contracts-coordinator
|
||||||
# TODO(dorothy-zbornak): Re-enable after updating this package for 3.0.
|
# TODO(dorothy-zbornak): Re-enable after updating this package for
|
||||||
|
# 3.0. At that time, also remove exclusion from monorepo
|
||||||
|
# package.json's test script.
|
||||||
# - run: yarn wsrun test:circleci @0x/contracts-extensions
|
# - run: yarn wsrun test:circleci @0x/contracts-extensions
|
||||||
test-publish:
|
test-publish:
|
||||||
resource_class: medium+
|
resource_class: medium+
|
||||||
@ -116,6 +118,9 @@ jobs:
|
|||||||
- run: yarn wsrun test:circleci @0x/abi-gen
|
- run: yarn wsrun test:circleci @0x/abi-gen
|
||||||
# TODO (xianny): Needs to be updated for 3.0
|
# TODO (xianny): Needs to be updated for 3.0
|
||||||
# - run: yarn wsrun test:circleci @0x/asset-buyer
|
# - run: yarn wsrun test:circleci @0x/asset-buyer
|
||||||
|
# TODO: Needs to be updated for 3.0. At that time, also remove
|
||||||
|
# exclusion from monorepo package.json's test script.
|
||||||
|
# - run: yarn wsrun test:circleci @0x/asset-swapper
|
||||||
- run: yarn wsrun test:circleci @0x/contract-artifacts
|
- run: yarn wsrun test:circleci @0x/contract-artifacts
|
||||||
- run: yarn wsrun test:circleci @0x/assert
|
- run: yarn wsrun test:circleci @0x/assert
|
||||||
- run: yarn wsrun test:circleci @0x/base-contract
|
- run: yarn wsrun test:circleci @0x/base-contract
|
||||||
@ -125,6 +130,9 @@ jobs:
|
|||||||
- run: yarn wsrun test:circleci @0x/dev-utils
|
- run: yarn wsrun test:circleci @0x/dev-utils
|
||||||
- run: yarn wsrun test:circleci @0x/json-schemas
|
- run: yarn wsrun test:circleci @0x/json-schemas
|
||||||
- run: yarn wsrun test:circleci @0x/order-utils
|
- run: yarn wsrun test:circleci @0x/order-utils
|
||||||
|
# TODO: Needs to be updated for 3.0. At that time, also remove
|
||||||
|
# exclusion from monorepo package.json's test script.
|
||||||
|
# - run: yarn wsrun test:circleci @0x/orderbook
|
||||||
- run: yarn wsrun test:circleci @0x/sol-compiler
|
- run: yarn wsrun test:circleci @0x/sol-compiler
|
||||||
- run: yarn wsrun test:circleci @0x/sol-tracing-utils
|
- run: yarn wsrun test:circleci @0x/sol-tracing-utils
|
||||||
- run: yarn wsrun test:circleci @0x/sol-doc
|
- run: yarn wsrun test:circleci @0x/sol-doc
|
||||||
|
@ -31,7 +31,6 @@ const MAX_UINT256 = new BigNumber(2).pow(256).minus(1);
|
|||||||
export const constants = {
|
export const constants = {
|
||||||
BASE_16: 16,
|
BASE_16: 16,
|
||||||
INVALID_OPCODE: 'invalid opcode',
|
INVALID_OPCODE: 'invalid opcode',
|
||||||
TESTRPC_NETWORK_ID: 50,
|
|
||||||
TESTRPC_CHAIN_ID: 1337,
|
TESTRPC_CHAIN_ID: 1337,
|
||||||
// Note(albrow): In practice V8 and most other engines limit the minimum
|
// Note(albrow): In practice V8 and most other engines limit the minimum
|
||||||
// interval for setInterval to 10ms. We still set it to 0 here in order to
|
// interval for setInterval to 10ms. We still set it to 0 here in order to
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
"contracts:watch": "wsrun watch $PKG --parallel --exclude-missing",
|
"contracts:watch": "wsrun watch $PKG --parallel --exclude-missing",
|
||||||
"remove_node_modules": "lerna clean --yes; rm -rf node_modules",
|
"remove_node_modules": "lerna clean --yes; rm -rf node_modules",
|
||||||
"rebuild": "run-s clean build",
|
"rebuild": "run-s clean build",
|
||||||
"test": "wsrun test $PKG --fast-exit --serial --exclude-missing",
|
"test": "wsrun test $PKG --fast-exit --serial --exclude-missing --exclude @0x/asset-swapper --exclude @0x/orderbook --exclude @0x/contracts-extensions",
|
||||||
"test:contracts": "wsrun test -p ${npm_package_config_contractsPackages} -c --fast-exit --serial --exclude-missing",
|
"test:contracts": "wsrun test -p ${npm_package_config_contractsPackages} -c --fast-exit --serial --exclude-missing",
|
||||||
"generate_doc": "node ./packages/monorepo-scripts/lib/doc_generate.js",
|
"generate_doc": "node ./packages/monorepo-scripts/lib/doc_generate.js",
|
||||||
"upload_md_docs": "aws s3 rm --recursive s3://docs-markdown; wsrun s3:sync_md_docs --exclude-missing",
|
"upload_md_docs": "aws s3 rm --recursive s3://docs-markdown; wsrun s3:sync_md_docs --exclude-missing",
|
||||||
|
@ -1,4 +1,13 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"version": "8.0.0-beta.0",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Exported intefaces changed: from getContractAddressesForNetworkOrThrow to getContractAddressesForChainOrThrow, from NetworkId to ChainId, from ContractNetworks to ContractChains, and from ContractNetworkData to ContractChainData.",
|
||||||
|
"pr": 2313
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"version": "7.1.0-beta.0",
|
"version": "7.1.0-beta.0",
|
||||||
"changes": [
|
"changes": [
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
export { getContractAddressesForNetworkOrThrow, NetworkId, ContractAddresses } from '@0x/contract-addresses';
|
export { getContractAddressesForChainOrThrow, ChainId, ContractAddresses } from '@0x/contract-addresses';
|
||||||
|
|
||||||
export {
|
export {
|
||||||
assetDataUtils,
|
assetDataUtils,
|
||||||
@ -124,11 +124,11 @@ export {
|
|||||||
BlockParam,
|
BlockParam,
|
||||||
CompilerOpts,
|
CompilerOpts,
|
||||||
StandardContractOutput,
|
StandardContractOutput,
|
||||||
ContractNetworks,
|
ContractChains,
|
||||||
TxDataPayable,
|
TxDataPayable,
|
||||||
BlockParamLiteral,
|
BlockParamLiteral,
|
||||||
CompilerSettings,
|
CompilerSettings,
|
||||||
ContractNetworkData,
|
ContractChainData,
|
||||||
DevdocOutput,
|
DevdocOutput,
|
||||||
EvmOutput,
|
EvmOutput,
|
||||||
CompilerSettingsMetadata,
|
CompilerSettingsMetadata,
|
||||||
|
@ -17,6 +17,10 @@
|
|||||||
{
|
{
|
||||||
"note": "In Python wrappers, fix bug with casting some bytes objects using bytes.fromhex()",
|
"note": "In Python wrappers, fix bug with casting some bytes objects using bytes.fromhex()",
|
||||||
"pr": 2284
|
"pr": 2284
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"note": "Command-line argument network-id has changed to chain-id",
|
||||||
|
"pr": 2313
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -28,7 +28,7 @@ import { utils } from './utils';
|
|||||||
const ABI_TYPE_CONSTRUCTOR = 'constructor';
|
const ABI_TYPE_CONSTRUCTOR = 'constructor';
|
||||||
const ABI_TYPE_METHOD = 'function';
|
const ABI_TYPE_METHOD = 'function';
|
||||||
const ABI_TYPE_EVENT = 'event';
|
const ABI_TYPE_EVENT = 'event';
|
||||||
const DEFAULT_NETWORK_ID = 50;
|
const DEFAULT_CHAIN_ID = 1337;
|
||||||
const DEFAULT_BACKEND = 'web3';
|
const DEFAULT_BACKEND = 'web3';
|
||||||
|
|
||||||
const args = yargs
|
const args = yargs
|
||||||
@ -65,10 +65,10 @@ const args = yargs
|
|||||||
choices: [ContractsBackend.Web3, ContractsBackend.Ethers],
|
choices: [ContractsBackend.Web3, ContractsBackend.Ethers],
|
||||||
default: DEFAULT_BACKEND,
|
default: DEFAULT_BACKEND,
|
||||||
})
|
})
|
||||||
.option('network-id', {
|
.option('chain-id', {
|
||||||
describe: 'ID of the network where contract ABIs are nested in artifacts',
|
describe: 'ID of the chain where contract ABIs are nested in artifacts',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
default: DEFAULT_NETWORK_ID,
|
default: DEFAULT_CHAIN_ID,
|
||||||
})
|
})
|
||||||
.option('language', {
|
.option('language', {
|
||||||
describe: 'Language of output file to generate',
|
describe: 'Language of output file to generate',
|
||||||
|
File diff suppressed because one or more lines are too long
@ -9,14 +9,14 @@
|
|||||||
"evm": {
|
"evm": {
|
||||||
"bytecode": {
|
"bytecode": {
|
||||||
"linkReferences": {},
|
"linkReferences": {},
|
||||||
"object": "0x60556023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea265627a7a72305820b14322cd05aa1dcae66812e472d3ab85cced78118ea7f9a5098d073b2accc45964736f6c634300050a0032",
|
"object": "0x60556023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea265627a7a72315820725ed7971b4c6a8dad5ee5e2dfb2083612f69a239b2ad69690a85c8e21d5f23864736f6c634300050c0032",
|
||||||
"opcodes": "PUSH1 0x55 PUSH1 0x23 PUSH1 0xB DUP3 DUP3 DUP3 CODECOPY DUP1 MLOAD PUSH1 0x0 BYTE PUSH1 0x73 EQ PUSH1 0x16 JUMPI INVALID JUMPDEST ADDRESS PUSH1 0x0 MSTORE PUSH1 0x73 DUP2 MSTORE8 DUP3 DUP2 RETURN INVALID PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x0 DUP1 REVERT INVALID LOG2 PUSH6 0x627A7A723058 KECCAK256 0xb1 NUMBER 0x22 0xcd SDIV 0xaa SAR 0xca 0xe6 PUSH9 0x12E472D3AB85CCED78 GT DUP15 0xa7 0xf9 0xa5 MULMOD DUP14 SMOD EXTCODESIZE 0x2a 0xcc 0xc4 MSIZE PUSH5 0x736F6C6343 STOP SDIV EXP STOP ORIGIN ",
|
"opcodes": "PUSH1 0x55 PUSH1 0x23 PUSH1 0xB DUP3 DUP3 DUP3 CODECOPY DUP1 MLOAD PUSH1 0x0 BYTE PUSH1 0x73 EQ PUSH1 0x16 JUMPI INVALID JUMPDEST ADDRESS PUSH1 0x0 MSTORE PUSH1 0x73 DUP2 MSTORE8 DUP3 DUP2 RETURN INVALID PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x0 DUP1 REVERT INVALID LOG2 PUSH6 0x627A7A723158 KECCAK256 PUSH19 0x5ED7971B4C6A8DAD5EE5E2DFB2083612F69A23 SWAP12 0x2a 0xd6 SWAP7 SWAP1 0xa8 0x5c DUP15 0x21 0xd5 CALLCODE CODESIZE PUSH5 0x736F6C6343 STOP SDIV 0xc STOP ORIGIN ",
|
||||||
"sourceMap": "606:385:1:-;;132:2:-1;166:7;155:9;146:7;137:37;255:7;249:14;246:1;241:23;235:4;232:33;222:2;;269:9;222:2;293:9;290:1;283:20;323:4;314:7;306:22;347:7;338;331:24"
|
"sourceMap": "606:385:1:-;;132:2:-1;166:7;155:9;146:7;137:37;255:7;249:14;246:1;241:23;235:4;232:33;222:2;;269:9;222:2;293:9;290:1;283:20;323:4;314:7;306:22;347:7;338;331:24"
|
||||||
},
|
},
|
||||||
"deployedBytecode": {
|
"deployedBytecode": {
|
||||||
"linkReferences": {},
|
"linkReferences": {},
|
||||||
"object": "0x73000000000000000000000000000000000000000030146080604052600080fdfea265627a7a72305820b14322cd05aa1dcae66812e472d3ab85cced78118ea7f9a5098d073b2accc45964736f6c634300050a0032",
|
"object": "0x73000000000000000000000000000000000000000030146080604052600080fdfea265627a7a72315820725ed7971b4c6a8dad5ee5e2dfb2083612f69a239b2ad69690a85c8e21d5f23864736f6c634300050c0032",
|
||||||
"opcodes": "PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x0 DUP1 REVERT INVALID LOG2 PUSH6 0x627A7A723058 KECCAK256 0xb1 NUMBER 0x22 0xcd SDIV 0xaa SAR 0xca 0xe6 PUSH9 0x12E472D3AB85CCED78 GT DUP15 0xa7 0xf9 0xa5 MULMOD DUP14 SMOD EXTCODESIZE 0x2a 0xcc 0xc4 MSIZE PUSH5 0x736F6C6343 STOP SDIV EXP STOP ORIGIN ",
|
"opcodes": "PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x0 DUP1 REVERT INVALID LOG2 PUSH6 0x627A7A723158 KECCAK256 PUSH19 0x5ED7971B4C6A8DAD5EE5E2DFB2083612F69A23 SWAP12 0x2a 0xd6 SWAP7 SWAP1 0xa8 0x5c DUP15 0x21 0xd5 CALLCODE CODESIZE PUSH5 0x736F6C6343 STOP SDIV 0xc STOP ORIGIN ",
|
||||||
"sourceMap": "606:385:1:-;;;;;;;;"
|
"sourceMap": "606:385:1:-;;;;;;;;"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -29,10 +29,10 @@
|
|||||||
"sourceCodes": {
|
"sourceCodes": {
|
||||||
"LibDummy.sol": "/*\n\n Copyright 2019 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.5.5;\n\n\nlibrary LibDummy {\n\n using LibDummy for uint256;\n uint256 constant internal SOME_CONSTANT = 1234;\n\n function addOne (uint256 x)\n internal\n pure\n returns (uint256 sum)\n {\n return x + 1;\n }\n\n function addConstant (uint256 x)\n internal\n pure\n returns (uint256 someConstant)\n {\n return x + SOME_CONSTANT;\n }\n}\n"
|
"LibDummy.sol": "/*\n\n Copyright 2019 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.5.5;\n\n\nlibrary LibDummy {\n\n using LibDummy for uint256;\n uint256 constant internal SOME_CONSTANT = 1234;\n\n function addOne (uint256 x)\n internal\n pure\n returns (uint256 sum)\n {\n return x + 1;\n }\n\n function addConstant (uint256 x)\n internal\n pure\n returns (uint256 someConstant)\n {\n return x + SOME_CONSTANT;\n }\n}\n"
|
||||||
},
|
},
|
||||||
"sourceTreeHashHex": "0xe9654f3d694bd3513dddbcc0ccd7a75739bf63dc92b974e163f191122416fdb6",
|
"sourceTreeHashHex": "0xd7314c6b96d3195f1d6823802c5a01b0090fe630f4908495ba19d9c298b3ded1",
|
||||||
"compiler": {
|
"compiler": {
|
||||||
"name": "solc",
|
"name": "solc",
|
||||||
"version": "soljson-v0.5.10+commit.5a6ea5b1.js",
|
"version": "soljson-v0.5.12+commit.7709ece9.js",
|
||||||
"settings": {
|
"settings": {
|
||||||
"optimizer": {
|
"optimizer": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
@ -60,5 +60,5 @@
|
|||||||
"remappings": []
|
"remappings": []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"networks": {}
|
"chains": {}
|
||||||
}
|
}
|
@ -7,6 +7,7 @@
|
|||||||
"constant": true,
|
"constant": true,
|
||||||
"inputs": [
|
"inputs": [
|
||||||
{
|
{
|
||||||
|
"internalType": "uint256",
|
||||||
"name": "x",
|
"name": "x",
|
||||||
"type": "uint256"
|
"type": "uint256"
|
||||||
}
|
}
|
||||||
@ -14,6 +15,7 @@
|
|||||||
"name": "publicAddConstant",
|
"name": "publicAddConstant",
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
|
"internalType": "uint256",
|
||||||
"name": "result",
|
"name": "result",
|
||||||
"type": "uint256"
|
"type": "uint256"
|
||||||
}
|
}
|
||||||
@ -26,6 +28,7 @@
|
|||||||
"constant": true,
|
"constant": true,
|
||||||
"inputs": [
|
"inputs": [
|
||||||
{
|
{
|
||||||
|
"internalType": "uint256",
|
||||||
"name": "x",
|
"name": "x",
|
||||||
"type": "uint256"
|
"type": "uint256"
|
||||||
}
|
}
|
||||||
@ -33,6 +36,7 @@
|
|||||||
"name": "publicAddOne",
|
"name": "publicAddOne",
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
|
"internalType": "uint256",
|
||||||
"name": "result",
|
"name": "result",
|
||||||
"type": "uint256"
|
"type": "uint256"
|
||||||
}
|
}
|
||||||
@ -48,14 +52,14 @@
|
|||||||
"evm": {
|
"evm": {
|
||||||
"bytecode": {
|
"bytecode": {
|
||||||
"linkReferences": {},
|
"linkReferences": {},
|
||||||
"object": "0x608060405234801561001057600080fd5b5060d78061001f6000396000f3fe6080604052348015600f57600080fd5b506004361060325760003560e01c806322935e921460375780632b82fdf0146063575b600080fd5b605160048036036020811015604b57600080fd5b5035607d565b60408051918252519081900360200190f35b605160048036036020811015607757600080fd5b5035608c565b60006086826095565b92915050565b6000608682609c565b6104d20190565b6001019056fea265627a7a72305820ddb720d14b34694daaefebcbd729af6ae04fa2232481812dd8fde63d6a4c32c164736f6c634300050a0032",
|
"object": "0x608060405234801561001057600080fd5b5060d78061001f6000396000f3fe6080604052348015600f57600080fd5b506004361060325760003560e01c806322935e921460375780632b82fdf0146063575b600080fd5b605160048036036020811015604b57600080fd5b5035607d565b60408051918252519081900360200190f35b605160048036036020811015607757600080fd5b5035608c565b60006086826095565b92915050565b6000608682609c565b6104d20190565b6001019056fea265627a7a72315820863e53f0da474a1275d583d88852313fe053941e79bddd5279abd812b31e020c64736f6c634300050c0032",
|
||||||
"opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0xD7 DUP1 PUSH2 0x1F PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH1 0xF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x4 CALLDATASIZE LT PUSH1 0x32 JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x22935E92 EQ PUSH1 0x37 JUMPI DUP1 PUSH4 0x2B82FDF0 EQ PUSH1 0x63 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x51 PUSH1 0x4 DUP1 CALLDATASIZE SUB PUSH1 0x20 DUP2 LT ISZERO PUSH1 0x4B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP CALLDATALOAD PUSH1 0x7D JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST PUSH1 0x51 PUSH1 0x4 DUP1 CALLDATASIZE SUB PUSH1 0x20 DUP2 LT ISZERO PUSH1 0x77 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP CALLDATALOAD PUSH1 0x8C JUMP JUMPDEST PUSH1 0x0 PUSH1 0x86 DUP3 PUSH1 0x95 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x86 DUP3 PUSH1 0x9C JUMP JUMPDEST PUSH2 0x4D2 ADD SWAP1 JUMP JUMPDEST PUSH1 0x1 ADD SWAP1 JUMP INVALID LOG2 PUSH6 0x627A7A723058 KECCAK256 0xdd 0xb7 KECCAK256 0xd1 0x4b CALLVALUE PUSH10 0x4DAAEFEBCBD729AF6AE0 0x4f LOG2 0x23 0x24 DUP2 DUP2 0x2d 0xd8 REVERT 0xe6 RETURNDATASIZE PUSH11 0x4C32C164736F6C63430005 EXP STOP ORIGIN ",
|
"opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0xD7 DUP1 PUSH2 0x1F PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH1 0xF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x4 CALLDATASIZE LT PUSH1 0x32 JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x22935E92 EQ PUSH1 0x37 JUMPI DUP1 PUSH4 0x2B82FDF0 EQ PUSH1 0x63 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x51 PUSH1 0x4 DUP1 CALLDATASIZE SUB PUSH1 0x20 DUP2 LT ISZERO PUSH1 0x4B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP CALLDATALOAD PUSH1 0x7D JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST PUSH1 0x51 PUSH1 0x4 DUP1 CALLDATASIZE SUB PUSH1 0x20 DUP2 LT ISZERO PUSH1 0x77 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP CALLDATALOAD PUSH1 0x8C JUMP JUMPDEST PUSH1 0x0 PUSH1 0x86 DUP3 PUSH1 0x95 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x86 DUP3 PUSH1 0x9C JUMP JUMPDEST PUSH2 0x4D2 ADD SWAP1 JUMP JUMPDEST PUSH1 0x1 ADD SWAP1 JUMP INVALID LOG2 PUSH6 0x627A7A723158 KECCAK256 DUP7 RETURNDATACOPY MSTORE8 CREATE 0xda SELFBALANCE 0x4a SLT PUSH22 0xD583D88852313FE053941E79BDDD5279ABD812B31E02 0xc PUSH5 0x736F6C6343 STOP SDIV 0xc STOP ORIGIN ",
|
||||||
"sourceMap": "632:346:2:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;632:346:2;;;;;;;"
|
"sourceMap": "632:346:2:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;632:346:2;;;;;;;"
|
||||||
},
|
},
|
||||||
"deployedBytecode": {
|
"deployedBytecode": {
|
||||||
"linkReferences": {},
|
"linkReferences": {},
|
||||||
"object": "0x6080604052348015600f57600080fd5b506004361060325760003560e01c806322935e921460375780632b82fdf0146063575b600080fd5b605160048036036020811015604b57600080fd5b5035607d565b60408051918252519081900360200190f35b605160048036036020811015607757600080fd5b5035608c565b60006086826095565b92915050565b6000608682609c565b6104d20190565b6001019056fea265627a7a72305820ddb720d14b34694daaefebcbd729af6ae04fa2232481812dd8fde63d6a4c32c164736f6c634300050a0032",
|
"object": "0x6080604052348015600f57600080fd5b506004361060325760003560e01c806322935e921460375780632b82fdf0146063575b600080fd5b605160048036036020811015604b57600080fd5b5035607d565b60408051918252519081900360200190f35b605160048036036020811015607757600080fd5b5035608c565b60006086826095565b92915050565b6000608682609c565b6104d20190565b6001019056fea265627a7a72315820863e53f0da474a1275d583d88852313fe053941e79bddd5279abd812b31e020c64736f6c634300050c0032",
|
||||||
"opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH1 0xF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x4 CALLDATASIZE LT PUSH1 0x32 JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x22935E92 EQ PUSH1 0x37 JUMPI DUP1 PUSH4 0x2B82FDF0 EQ PUSH1 0x63 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x51 PUSH1 0x4 DUP1 CALLDATASIZE SUB PUSH1 0x20 DUP2 LT ISZERO PUSH1 0x4B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP CALLDATALOAD PUSH1 0x7D JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST PUSH1 0x51 PUSH1 0x4 DUP1 CALLDATASIZE SUB PUSH1 0x20 DUP2 LT ISZERO PUSH1 0x77 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP CALLDATALOAD PUSH1 0x8C JUMP JUMPDEST PUSH1 0x0 PUSH1 0x86 DUP3 PUSH1 0x95 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x86 DUP3 PUSH1 0x9C JUMP JUMPDEST PUSH2 0x4D2 ADD SWAP1 JUMP JUMPDEST PUSH1 0x1 ADD SWAP1 JUMP INVALID LOG2 PUSH6 0x627A7A723058 KECCAK256 0xdd 0xb7 KECCAK256 0xd1 0x4b CALLVALUE PUSH10 0x4DAAEFEBCBD729AF6AE0 0x4f LOG2 0x23 0x24 DUP2 DUP2 0x2d 0xd8 REVERT 0xe6 RETURNDATASIZE PUSH11 0x4C32C164736F6C63430005 EXP STOP ORIGIN ",
|
"opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH1 0xF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x4 CALLDATASIZE LT PUSH1 0x32 JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x22935E92 EQ PUSH1 0x37 JUMPI DUP1 PUSH4 0x2B82FDF0 EQ PUSH1 0x63 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x51 PUSH1 0x4 DUP1 CALLDATASIZE SUB PUSH1 0x20 DUP2 LT ISZERO PUSH1 0x4B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP CALLDATALOAD PUSH1 0x7D JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST PUSH1 0x51 PUSH1 0x4 DUP1 CALLDATASIZE SUB PUSH1 0x20 DUP2 LT ISZERO PUSH1 0x77 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP CALLDATALOAD PUSH1 0x8C JUMP JUMPDEST PUSH1 0x0 PUSH1 0x86 DUP3 PUSH1 0x95 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x86 DUP3 PUSH1 0x9C JUMP JUMPDEST PUSH2 0x4D2 ADD SWAP1 JUMP JUMPDEST PUSH1 0x1 ADD SWAP1 JUMP INVALID LOG2 PUSH6 0x627A7A723158 KECCAK256 DUP7 RETURNDATACOPY MSTORE8 CREATE 0xda SELFBALANCE 0x4a SLT PUSH22 0xD583D88852313FE053941E79BDDD5279ABD812B31E02 0xc PUSH5 0x736F6C6343 STOP SDIV 0xc STOP ORIGIN ",
|
||||||
"sourceMap": "632:346:2:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;632:346:2;;;;;;;;;;;;;;;;;;;;;;;;833:143;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;833:143:2;;:::i;:::-;;;;;;;;;;;;;;;;694:133;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;694:133:2;;:::i;833:143::-;917:14;954:15;:1;:13;:15::i;:::-;947:22;833:143;-1:-1:-1;;833:143:2:o;694:133::-;773:14;810:10;:1;:8;:10::i;842:147:1:-;704:4;965:17;;842:147::o;715:121::-;828:1;824:5;;715:121::o"
|
"sourceMap": "632:346:2:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;632:346:2;;;;;;;;;;;;;;;;;;;;;;;;833:143;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;833:143:2;;:::i;:::-;;;;;;;;;;;;;;;;694:133;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;694:133:2;;:::i;833:143::-;917:14;954:15;:1;:13;:15::i;:::-;947:22;833:143;-1:-1:-1;;833:143:2:o;694:133::-;773:14;810:10;:1;:8;:10::i;842:147:1:-;704:4;965:17;;842:147::o;715:121::-;828:1;824:5;;715:121::o"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -72,10 +76,10 @@
|
|||||||
"TestLibDummy.sol": "/*\n\n Copyright 2019 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.5.5;\n\nimport \"./LibDummy.sol\";\n\n\ncontract TestLibDummy {\n\n using LibDummy for uint256;\n\n function publicAddOne (uint256 x)\n public\n pure\n returns (uint256 result)\n {\n return x.addOne();\n }\n\n function publicAddConstant (uint256 x)\n public\n pure\n returns (uint256 result)\n {\n return x.addConstant();\n }\n}\n",
|
"TestLibDummy.sol": "/*\n\n Copyright 2019 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.5.5;\n\nimport \"./LibDummy.sol\";\n\n\ncontract TestLibDummy {\n\n using LibDummy for uint256;\n\n function publicAddOne (uint256 x)\n public\n pure\n returns (uint256 result)\n {\n return x.addOne();\n }\n\n function publicAddConstant (uint256 x)\n public\n pure\n returns (uint256 result)\n {\n return x.addConstant();\n }\n}\n",
|
||||||
"LibDummy.sol": "/*\n\n Copyright 2019 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.5.5;\n\n\nlibrary LibDummy {\n\n using LibDummy for uint256;\n uint256 constant internal SOME_CONSTANT = 1234;\n\n function addOne (uint256 x)\n internal\n pure\n returns (uint256 sum)\n {\n return x + 1;\n }\n\n function addConstant (uint256 x)\n internal\n pure\n returns (uint256 someConstant)\n {\n return x + SOME_CONSTANT;\n }\n}\n"
|
"LibDummy.sol": "/*\n\n Copyright 2019 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.5.5;\n\n\nlibrary LibDummy {\n\n using LibDummy for uint256;\n uint256 constant internal SOME_CONSTANT = 1234;\n\n function addOne (uint256 x)\n internal\n pure\n returns (uint256 sum)\n {\n return x + 1;\n }\n\n function addConstant (uint256 x)\n internal\n pure\n returns (uint256 someConstant)\n {\n return x + SOME_CONSTANT;\n }\n}\n"
|
||||||
},
|
},
|
||||||
"sourceTreeHashHex": "0xca99c7d7de9db975842de61e6ec01debdada66cf91d28fc3f2983de3011560dc",
|
"sourceTreeHashHex": "0xd7efa9dfeb2bbdec2bead8b892d1288c1398b34216d26c6a48bffb25c692bbc0",
|
||||||
"compiler": {
|
"compiler": {
|
||||||
"name": "solc",
|
"name": "solc",
|
||||||
"version": "soljson-v0.5.10+commit.5a6ea5b1.js",
|
"version": "soljson-v0.5.12+commit.7709ece9.js",
|
||||||
"settings": {
|
"settings": {
|
||||||
"optimizer": {
|
"optimizer": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
@ -103,5 +107,5 @@
|
|||||||
"remappings": []
|
"remappings": []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"networks": {}
|
"chains": {}
|
||||||
}
|
}
|
File diff suppressed because one or more lines are too long
@ -90,7 +90,7 @@ class LibDummy:
|
|||||||
try:
|
try:
|
||||||
for middleware in MIDDLEWARE:
|
for middleware in MIDDLEWARE:
|
||||||
web3.middleware_onion.inject(
|
web3.middleware_onion.inject(
|
||||||
middleware["function"], layer=middleware["layer"]
|
middleware["function"], layer=middleware["layer"],
|
||||||
)
|
)
|
||||||
except ValueError as value_error:
|
except ValueError as value_error:
|
||||||
if value_error.args == (
|
if value_error.args == (
|
||||||
|
@ -119,7 +119,7 @@ class PublicAddOneMethod(ContractMethod):
|
|||||||
def validate_and_normalize_inputs(self, x: int):
|
def validate_and_normalize_inputs(self, x: int):
|
||||||
"""Validate the inputs to the publicAddOne method."""
|
"""Validate the inputs to the publicAddOne method."""
|
||||||
self.validator.assert_valid(
|
self.validator.assert_valid(
|
||||||
method_name="publicAddOne", parameter_name="x", argument_value=x
|
method_name="publicAddOne", parameter_name="x", argument_value=x,
|
||||||
)
|
)
|
||||||
# safeguard against fractional inputs
|
# safeguard against fractional inputs
|
||||||
x = int(x)
|
x = int(x)
|
||||||
@ -212,7 +212,7 @@ class TestLibDummy:
|
|||||||
try:
|
try:
|
||||||
for middleware in MIDDLEWARE:
|
for middleware in MIDDLEWARE:
|
||||||
web3.middleware_onion.inject(
|
web3.middleware_onion.inject(
|
||||||
middleware["function"], layer=middleware["layer"]
|
middleware["function"], layer=middleware["layer"],
|
||||||
)
|
)
|
||||||
except ValueError as value_error:
|
except ValueError as value_error:
|
||||||
if value_error.args == (
|
if value_error.args == (
|
||||||
@ -245,7 +245,7 @@ class TestLibDummy:
|
|||||||
def abi():
|
def abi():
|
||||||
"""Return the ABI to the underlying contract."""
|
"""Return the ABI to the underlying contract."""
|
||||||
return json.loads(
|
return json.loads(
|
||||||
'[{"constant":true,"inputs":[{"name":"x","type":"uint256"}],"name":"publicAddConstant","outputs":[{"name":"result","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[{"name":"x","type":"uint256"}],"name":"publicAddOne","outputs":[{"name":"result","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"}]' # noqa: E501 (line-too-long)
|
'[{"constant":true,"inputs":[{"internalType":"uint256","name":"x","type":"uint256"}],"name":"publicAddConstant","outputs":[{"internalType":"uint256","name":"result","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"x","type":"uint256"}],"name":"publicAddOne","outputs":[{"internalType":"uint256","name":"result","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"}]' # noqa: E501 (line-too-long)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
@ -38,7 +38,7 @@ export class TestLibDummyContract extends BaseContract {
|
|||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
public static deployedBytecode =
|
public static deployedBytecode =
|
||||||
'0x6080604052348015600f57600080fd5b506004361060325760003560e01c806322935e921460375780632b82fdf0146063575b600080fd5b605160048036036020811015604b57600080fd5b5035607d565b60408051918252519081900360200190f35b605160048036036020811015607757600080fd5b5035608c565b60006086826095565b92915050565b6000608682609c565b6104d20190565b6001019056fea265627a7a72305820ddb720d14b34694daaefebcbd729af6ae04fa2232481812dd8fde63d6a4c32c164736f6c634300050a0032';
|
'0x6080604052348015600f57600080fd5b506004361060325760003560e01c806322935e921460375780632b82fdf0146063575b600080fd5b605160048036036020811015604b57600080fd5b5035607d565b60408051918252519081900360200190f35b605160048036036020811015607757600080fd5b5035608c565b60006086826095565b92915050565b6000608682609c565b6104d20190565b6001019056fea265627a7a72315820863e53f0da474a1275d583d88852313fe053941e79bddd5279abd812b31e020c64736f6c634300050c0032';
|
||||||
public publicAddConstant = {
|
public publicAddConstant = {
|
||||||
/**
|
/**
|
||||||
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
|
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
|
||||||
|
@ -1,4 +1,13 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"version": "7.0.0-beta.0",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "All references to network ID have been removed, and references to chain ID have been introduced instead",
|
||||||
|
"pr": 2313
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"version": "6.2.0-beta.0",
|
"version": "6.2.0-beta.0",
|
||||||
"changes": [
|
"changes": [
|
||||||
|
@ -35,7 +35,7 @@ interface OrdersEntry {
|
|||||||
export class AssetBuyer {
|
export class AssetBuyer {
|
||||||
public readonly provider: ZeroExProvider;
|
public readonly provider: ZeroExProvider;
|
||||||
public readonly orderProvider: OrderProvider;
|
public readonly orderProvider: OrderProvider;
|
||||||
public readonly networkId: number;
|
public readonly chainId: number;
|
||||||
public readonly orderRefreshIntervalMs: number;
|
public readonly orderRefreshIntervalMs: number;
|
||||||
public readonly expiryBufferSeconds: number;
|
public readonly expiryBufferSeconds: number;
|
||||||
private readonly _contractWrappers: ContractWrappers;
|
private readonly _contractWrappers: ContractWrappers;
|
||||||
@ -76,8 +76,8 @@ export class AssetBuyer {
|
|||||||
): AssetBuyer {
|
): AssetBuyer {
|
||||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||||
assert.isWebUri('sraApiUrl', sraApiUrl);
|
assert.isWebUri('sraApiUrl', sraApiUrl);
|
||||||
const networkId = options.networkId || constants.DEFAULT_ASSET_BUYER_OPTS.networkId;
|
const chainId = options.chainId || constants.DEFAULT_ASSET_BUYER_OPTS.chainId;
|
||||||
const orderProvider = new StandardRelayerAPIOrderProvider(sraApiUrl, networkId);
|
const orderProvider = new StandardRelayerAPIOrderProvider(sraApiUrl, chainId);
|
||||||
const assetBuyer = new AssetBuyer(provider, orderProvider, options);
|
const assetBuyer = new AssetBuyer(provider, orderProvider, options);
|
||||||
return assetBuyer;
|
return assetBuyer;
|
||||||
}
|
}
|
||||||
@ -94,23 +94,23 @@ export class AssetBuyer {
|
|||||||
orderProvider: OrderProvider,
|
orderProvider: OrderProvider,
|
||||||
options: Partial<AssetBuyerOpts> = {},
|
options: Partial<AssetBuyerOpts> = {},
|
||||||
) {
|
) {
|
||||||
const { networkId, orderRefreshIntervalMs, expiryBufferSeconds } = _.merge(
|
const { chainId, orderRefreshIntervalMs, expiryBufferSeconds } = _.merge(
|
||||||
{},
|
{},
|
||||||
constants.DEFAULT_ASSET_BUYER_OPTS,
|
constants.DEFAULT_ASSET_BUYER_OPTS,
|
||||||
options,
|
options,
|
||||||
);
|
);
|
||||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||||
assert.isValidOrderProvider('orderProvider', orderProvider);
|
assert.isValidOrderProvider('orderProvider', orderProvider);
|
||||||
assert.isNumber('networkId', networkId);
|
assert.isNumber('chainId', chainId);
|
||||||
assert.isNumber('orderRefreshIntervalMs', orderRefreshIntervalMs);
|
assert.isNumber('orderRefreshIntervalMs', orderRefreshIntervalMs);
|
||||||
assert.isNumber('expiryBufferSeconds', expiryBufferSeconds);
|
assert.isNumber('expiryBufferSeconds', expiryBufferSeconds);
|
||||||
this.provider = provider;
|
this.provider = provider;
|
||||||
this.orderProvider = orderProvider;
|
this.orderProvider = orderProvider;
|
||||||
this.networkId = networkId;
|
this.chainId = chainId;
|
||||||
this.orderRefreshIntervalMs = orderRefreshIntervalMs;
|
this.orderRefreshIntervalMs = orderRefreshIntervalMs;
|
||||||
this.expiryBufferSeconds = expiryBufferSeconds;
|
this.expiryBufferSeconds = expiryBufferSeconds;
|
||||||
this._contractWrappers = new ContractWrappers(this.provider, {
|
this._contractWrappers = new ContractWrappers(this.provider, {
|
||||||
networkId,
|
chainId,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@ -331,7 +331,7 @@ export class AssetBuyer {
|
|||||||
const orderProviderRequest = {
|
const orderProviderRequest = {
|
||||||
makerAssetData: assetData,
|
makerAssetData: assetData,
|
||||||
takerAssetData: etherTokenAssetData,
|
takerAssetData: etherTokenAssetData,
|
||||||
networkId: this.networkId,
|
chainId: this.chainId,
|
||||||
};
|
};
|
||||||
const request = orderProviderRequest;
|
const request = orderProviderRequest;
|
||||||
// get provider response
|
// get provider response
|
||||||
@ -357,14 +357,14 @@ export class AssetBuyer {
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Get the assetData that represents the WETH token.
|
* Get the assetData that represents the WETH token.
|
||||||
* Will throw if WETH does not exist for the current network.
|
* Will throw if WETH does not exist for the current chain.
|
||||||
*/
|
*/
|
||||||
private _getEtherTokenAssetDataOrThrow(): string {
|
private _getEtherTokenAssetDataOrThrow(): string {
|
||||||
return assetDataUtils.encodeERC20AssetData(this._contractWrappers.contractAddresses.etherToken);
|
return assetDataUtils.encodeERC20AssetData(this._contractWrappers.contractAddresses.etherToken);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Get the assetData that represents the ZRX token.
|
* Get the assetData that represents the ZRX token.
|
||||||
* Will throw if ZRX does not exist for the current network.
|
* Will throw if ZRX does not exist for the current chain.
|
||||||
*/
|
*/
|
||||||
private _getZrxTokenAssetDataOrThrow(): string {
|
private _getZrxTokenAssetDataOrThrow(): string {
|
||||||
return assetDataUtils.encodeERC20AssetData(this._contractWrappers.contractAddresses.zrxToken);
|
return assetDataUtils.encodeERC20AssetData(this._contractWrappers.contractAddresses.zrxToken);
|
||||||
|
@ -4,10 +4,10 @@ import { BigNumber } from '@0x/utils';
|
|||||||
import { AssetBuyerOpts, BuyQuoteExecutionOpts, BuyQuoteRequestOpts, OrdersAndFillableAmounts } from './types';
|
import { AssetBuyerOpts, BuyQuoteExecutionOpts, BuyQuoteRequestOpts, OrdersAndFillableAmounts } from './types';
|
||||||
|
|
||||||
const NULL_ADDRESS = '0x0000000000000000000000000000000000000000';
|
const NULL_ADDRESS = '0x0000000000000000000000000000000000000000';
|
||||||
const MAINNET_NETWORK_ID = 1;
|
const MAINNET_CHAIN_ID = 1;
|
||||||
|
|
||||||
const DEFAULT_ASSET_BUYER_OPTS: AssetBuyerOpts = {
|
const DEFAULT_ASSET_BUYER_OPTS: AssetBuyerOpts = {
|
||||||
networkId: MAINNET_NETWORK_ID,
|
chainId: MAINNET_CHAIN_ID,
|
||||||
orderRefreshIntervalMs: 10000, // 10 seconds
|
orderRefreshIntervalMs: 10000, // 10 seconds
|
||||||
expiryBufferSeconds: 120, // 2 minutes
|
expiryBufferSeconds: 120, // 2 minutes
|
||||||
};
|
};
|
||||||
@ -31,7 +31,7 @@ const EMPTY_ORDERS_AND_FILLABLE_AMOUNTS: OrdersAndFillableAmounts = {
|
|||||||
export const constants = {
|
export const constants = {
|
||||||
ZERO_AMOUNT: new BigNumber(0),
|
ZERO_AMOUNT: new BigNumber(0),
|
||||||
NULL_ADDRESS,
|
NULL_ADDRESS,
|
||||||
MAINNET_NETWORK_ID,
|
MAINNET_CHAIN_ID,
|
||||||
ETHER_TOKEN_DECIMALS: 18,
|
ETHER_TOKEN_DECIMALS: 18,
|
||||||
DEFAULT_ASSET_BUYER_OPTS,
|
DEFAULT_ASSET_BUYER_OPTS,
|
||||||
DEFAULT_BUY_QUOTE_EXECUTION_OPTS,
|
DEFAULT_BUY_QUOTE_EXECUTION_OPTS,
|
||||||
|
@ -15,7 +15,7 @@ import { assert } from '../utils/assert';
|
|||||||
|
|
||||||
export class StandardRelayerAPIOrderProvider implements OrderProvider {
|
export class StandardRelayerAPIOrderProvider implements OrderProvider {
|
||||||
public readonly apiUrl: string;
|
public readonly apiUrl: string;
|
||||||
public readonly networkId: number;
|
public readonly chainId: number;
|
||||||
private readonly _sraClient: HttpClient;
|
private readonly _sraClient: HttpClient;
|
||||||
/**
|
/**
|
||||||
* Given an array of APIOrder objects from a standard relayer api, return an array
|
* Given an array of APIOrder objects from a standard relayer api, return an array
|
||||||
@ -49,14 +49,14 @@ export class StandardRelayerAPIOrderProvider implements OrderProvider {
|
|||||||
/**
|
/**
|
||||||
* Instantiates a new StandardRelayerAPIOrderProvider instance
|
* Instantiates a new StandardRelayerAPIOrderProvider instance
|
||||||
* @param apiUrl The standard relayer API base HTTP url you would like to source orders from.
|
* @param apiUrl The standard relayer API base HTTP url you would like to source orders from.
|
||||||
* @param networkId The ethereum network id.
|
* @param chainId The ethereum chain id.
|
||||||
* @return An instance of StandardRelayerAPIOrderProvider
|
* @return An instance of StandardRelayerAPIOrderProvider
|
||||||
*/
|
*/
|
||||||
constructor(apiUrl: string, networkId: number) {
|
constructor(apiUrl: string, chainId: number) {
|
||||||
assert.isWebUri('apiUrl', apiUrl);
|
assert.isWebUri('apiUrl', apiUrl);
|
||||||
assert.isNumber('networkId', networkId);
|
assert.isNumber('chainId', chainId);
|
||||||
this.apiUrl = apiUrl;
|
this.apiUrl = apiUrl;
|
||||||
this.networkId = networkId;
|
this.chainId = chainId;
|
||||||
this._sraClient = new HttpClient(apiUrl);
|
this._sraClient = new HttpClient(apiUrl);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@ -68,7 +68,7 @@ export class StandardRelayerAPIOrderProvider implements OrderProvider {
|
|||||||
assert.isValidOrderProviderRequest('orderProviderRequest', orderProviderRequest);
|
assert.isValidOrderProviderRequest('orderProviderRequest', orderProviderRequest);
|
||||||
const { makerAssetData, takerAssetData } = orderProviderRequest;
|
const { makerAssetData, takerAssetData } = orderProviderRequest;
|
||||||
const orderbookRequest = { baseAssetData: makerAssetData, quoteAssetData: takerAssetData };
|
const orderbookRequest = { baseAssetData: makerAssetData, quoteAssetData: takerAssetData };
|
||||||
const requestOpts = { networkId: this.networkId };
|
const requestOpts = { chainId: this.chainId };
|
||||||
let orderbook: OrderbookResponse;
|
let orderbook: OrderbookResponse;
|
||||||
try {
|
try {
|
||||||
orderbook = await this._sraClient.getOrderbookAsync(orderbookRequest, requestOpts);
|
orderbook = await this._sraClient.getOrderbookAsync(orderbookRequest, requestOpts);
|
||||||
@ -91,7 +91,7 @@ export class StandardRelayerAPIOrderProvider implements OrderProvider {
|
|||||||
public async getAvailableMakerAssetDatasAsync(takerAssetData: string): Promise<string[]> {
|
public async getAvailableMakerAssetDatasAsync(takerAssetData: string): Promise<string[]> {
|
||||||
// Return a maximum of 1000 asset datas
|
// Return a maximum of 1000 asset datas
|
||||||
const maxPerPage = 1000;
|
const maxPerPage = 1000;
|
||||||
const requestOpts = { networkId: this.networkId, perPage: maxPerPage };
|
const requestOpts = { chainId: this.chainId, perPage: maxPerPage };
|
||||||
const assetPairsRequest = { assetDataA: takerAssetData };
|
const assetPairsRequest = { assetDataA: takerAssetData };
|
||||||
const fullRequest = {
|
const fullRequest = {
|
||||||
...requestOpts,
|
...requestOpts,
|
||||||
|
@ -4,7 +4,7 @@ import { BigNumber } from '@0x/utils';
|
|||||||
/**
|
/**
|
||||||
* makerAssetData: The assetData representing the desired makerAsset.
|
* makerAssetData: The assetData representing the desired makerAsset.
|
||||||
* takerAssetData: The assetData representing the desired takerAsset.
|
* takerAssetData: The assetData representing the desired takerAsset.
|
||||||
* networkId: The networkId that the desired orders should be for.
|
* chainId: The chainId that the desired orders should be for.
|
||||||
*/
|
*/
|
||||||
export interface OrderProviderRequest {
|
export interface OrderProviderRequest {
|
||||||
makerAssetData: string;
|
makerAssetData: string;
|
||||||
@ -98,12 +98,12 @@ export interface BuyQuoteExecutionOpts {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* networkId: The ethereum network id. Defaults to 1 (mainnet).
|
* chainId: The ethereum chain 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).
|
* 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 300s (5m).
|
* expiryBufferSeconds: The number of seconds to add when calculating whether an order is expired or not. Defaults to 300s (5m).
|
||||||
*/
|
*/
|
||||||
export interface AssetBuyerOpts {
|
export interface AssetBuyerOpts {
|
||||||
networkId: number;
|
chainId: number;
|
||||||
orderRefreshIntervalMs: number;
|
orderRefreshIntervalMs: number;
|
||||||
expiryBufferSeconds: number;
|
expiryBufferSeconds: number;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,13 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"version": "3.0.0-beta.0",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "All references to network ID have been removed, and references to chain ID have been introduced instead",
|
||||||
|
"pr": 2313
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"version": "2.1.0-beta.0",
|
"version": "2.1.0-beta.0",
|
||||||
"changes": [
|
"changes": [
|
||||||
|
@ -11,12 +11,12 @@ import {
|
|||||||
|
|
||||||
const NULL_BYTES = '0x';
|
const NULL_BYTES = '0x';
|
||||||
const NULL_ADDRESS = '0x0000000000000000000000000000000000000000';
|
const NULL_ADDRESS = '0x0000000000000000000000000000000000000000';
|
||||||
const MAINNET_NETWORK_ID = 1;
|
const MAINNET_CHAIN_ID = 1;
|
||||||
const ONE_SECOND_MS = 1000;
|
const ONE_SECOND_MS = 1000;
|
||||||
const DEFAULT_PER_PAGE = 1000;
|
const DEFAULT_PER_PAGE = 1000;
|
||||||
|
|
||||||
const DEFAULT_SWAP_QUOTER_OPTS: SwapQuoterOpts = {
|
const DEFAULT_SWAP_QUOTER_OPTS: SwapQuoterOpts = {
|
||||||
networkId: MAINNET_NETWORK_ID,
|
chainId: MAINNET_CHAIN_ID,
|
||||||
orderRefreshIntervalMs: 10000, // 10 seconds
|
orderRefreshIntervalMs: 10000, // 10 seconds
|
||||||
expiryBufferMs: 120000, // 2 minutes
|
expiryBufferMs: 120000, // 2 minutes
|
||||||
};
|
};
|
||||||
@ -42,7 +42,7 @@ export const constants = {
|
|||||||
NULL_BYTES,
|
NULL_BYTES,
|
||||||
ZERO_AMOUNT: new BigNumber(0),
|
ZERO_AMOUNT: new BigNumber(0),
|
||||||
NULL_ADDRESS,
|
NULL_ADDRESS,
|
||||||
MAINNET_NETWORK_ID,
|
MAINNET_CHAIN_ID,
|
||||||
ETHER_TOKEN_DECIMALS: 18,
|
ETHER_TOKEN_DECIMALS: 18,
|
||||||
ONE_AMOUNT: new BigNumber(1),
|
ONE_AMOUNT: new BigNumber(1),
|
||||||
ONE_SECOND_MS,
|
ONE_SECOND_MS,
|
||||||
|
@ -23,19 +23,19 @@ import { utils } from '../utils/utils';
|
|||||||
|
|
||||||
export class ExchangeSwapQuoteConsumer implements SwapQuoteConsumerBase<ExchangeSmartContractParams> {
|
export class ExchangeSwapQuoteConsumer implements SwapQuoteConsumerBase<ExchangeSmartContractParams> {
|
||||||
public readonly provider: ZeroExProvider;
|
public readonly provider: ZeroExProvider;
|
||||||
public readonly networkId: number;
|
public readonly chainId: number;
|
||||||
|
|
||||||
private readonly _contractWrappers: ContractWrappers;
|
private readonly _contractWrappers: ContractWrappers;
|
||||||
|
|
||||||
constructor(supportedProvider: SupportedProvider, options: Partial<SwapQuoteConsumerOpts> = {}) {
|
constructor(supportedProvider: SupportedProvider, options: Partial<SwapQuoteConsumerOpts> = {}) {
|
||||||
const { networkId } = _.merge({}, constants.DEFAULT_SWAP_QUOTER_OPTS, options);
|
const { chainId } = _.merge({}, constants.DEFAULT_SWAP_QUOTER_OPTS, options);
|
||||||
assert.isNumber('networkId', networkId);
|
assert.isNumber('chainId', chainId);
|
||||||
|
|
||||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||||
this.provider = provider;
|
this.provider = provider;
|
||||||
this.networkId = networkId;
|
this.chainId = chainId;
|
||||||
this._contractWrappers = new ContractWrappers(this.provider, {
|
this._contractWrappers = new ContractWrappers(this.provider, {
|
||||||
networkId,
|
chainId,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,19 +25,19 @@ import { utils } from '../utils/utils';
|
|||||||
|
|
||||||
export class ForwarderSwapQuoteConsumer implements SwapQuoteConsumerBase<ForwarderSmartContractParams> {
|
export class ForwarderSwapQuoteConsumer implements SwapQuoteConsumerBase<ForwarderSmartContractParams> {
|
||||||
public readonly provider: ZeroExProvider;
|
public readonly provider: ZeroExProvider;
|
||||||
public readonly networkId: number;
|
public readonly chainId: number;
|
||||||
|
|
||||||
private readonly _contractWrappers: ContractWrappers;
|
private readonly _contractWrappers: ContractWrappers;
|
||||||
|
|
||||||
constructor(supportedProvider: SupportedProvider, options: Partial<SwapQuoteConsumerOpts> = {}) {
|
constructor(supportedProvider: SupportedProvider, options: Partial<SwapQuoteConsumerOpts> = {}) {
|
||||||
const { networkId } = _.merge({}, constants.DEFAULT_SWAP_QUOTER_OPTS, options);
|
const { chainId } = _.merge({}, constants.DEFAULT_SWAP_QUOTER_OPTS, options);
|
||||||
assert.isNumber('networkId', networkId);
|
assert.isNumber('chainId', chainId);
|
||||||
|
|
||||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||||
this.provider = provider;
|
this.provider = provider;
|
||||||
this.networkId = networkId;
|
this.chainId = chainId;
|
||||||
this._contractWrappers = new ContractWrappers(this.provider, {
|
this._contractWrappers = new ContractWrappers(this.provider, {
|
||||||
networkId,
|
chainId,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,24 +24,24 @@ import { ForwarderSwapQuoteConsumer } from './forwarder_swap_quote_consumer';
|
|||||||
|
|
||||||
export class SwapQuoteConsumer implements SwapQuoteConsumerBase<SmartContractParams> {
|
export class SwapQuoteConsumer implements SwapQuoteConsumerBase<SmartContractParams> {
|
||||||
public readonly provider: ZeroExProvider;
|
public readonly provider: ZeroExProvider;
|
||||||
public readonly networkId: number;
|
public readonly chainId: number;
|
||||||
|
|
||||||
private readonly _exchangeConsumer: ExchangeSwapQuoteConsumer;
|
private readonly _exchangeConsumer: ExchangeSwapQuoteConsumer;
|
||||||
private readonly _forwarderConsumer: ForwarderSwapQuoteConsumer;
|
private readonly _forwarderConsumer: ForwarderSwapQuoteConsumer;
|
||||||
private readonly _contractWrappers: ContractWrappers;
|
private readonly _contractWrappers: ContractWrappers;
|
||||||
|
|
||||||
constructor(supportedProvider: SupportedProvider, options: Partial<SwapQuoteConsumerOpts> = {}) {
|
constructor(supportedProvider: SupportedProvider, options: Partial<SwapQuoteConsumerOpts> = {}) {
|
||||||
const { networkId } = _.merge({}, constants.DEFAULT_SWAP_QUOTER_OPTS, options);
|
const { chainId } = _.merge({}, constants.DEFAULT_SWAP_QUOTER_OPTS, options);
|
||||||
assert.isNumber('networkId', networkId);
|
assert.isNumber('chainId', chainId);
|
||||||
|
|
||||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||||
this.provider = provider;
|
this.provider = provider;
|
||||||
this.networkId = networkId;
|
this.chainId = chainId;
|
||||||
|
|
||||||
this._exchangeConsumer = new ExchangeSwapQuoteConsumer(supportedProvider, options);
|
this._exchangeConsumer = new ExchangeSwapQuoteConsumer(supportedProvider, options);
|
||||||
this._forwarderConsumer = new ForwarderSwapQuoteConsumer(supportedProvider, options);
|
this._forwarderConsumer = new ForwarderSwapQuoteConsumer(supportedProvider, options);
|
||||||
this._contractWrappers = new ContractWrappers(this.provider, {
|
this._contractWrappers = new ContractWrappers(this.provider, {
|
||||||
networkId,
|
chainId,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ export class SwapQuoter {
|
|||||||
httpEndpoint: sraApiUrl,
|
httpEndpoint: sraApiUrl,
|
||||||
pollingIntervalMs:
|
pollingIntervalMs:
|
||||||
options.orderRefreshIntervalMs || constants.DEFAULT_SWAP_QUOTER_OPTS.orderRefreshIntervalMs,
|
options.orderRefreshIntervalMs || constants.DEFAULT_SWAP_QUOTER_OPTS.orderRefreshIntervalMs,
|
||||||
networkId: options.networkId || constants.DEFAULT_SWAP_QUOTER_OPTS.networkId,
|
chainId: options.chainId || constants.DEFAULT_SWAP_QUOTER_OPTS.chainId,
|
||||||
perPage: options.perPage || constants.DEFAULT_PER_PAGE,
|
perPage: options.perPage || constants.DEFAULT_PER_PAGE,
|
||||||
});
|
});
|
||||||
const swapQuoter = new SwapQuoter(provider, orderbook, options);
|
const swapQuoter = new SwapQuoter(provider, orderbook, options);
|
||||||
@ -97,7 +97,7 @@ export class SwapQuoter {
|
|||||||
const orderbook = Orderbook.getOrderbookForWebsocketProvider({
|
const orderbook = Orderbook.getOrderbookForWebsocketProvider({
|
||||||
httpEndpoint: sraApiUrl,
|
httpEndpoint: sraApiUrl,
|
||||||
websocketEndpoint: sraWebsocketAPIUrl,
|
websocketEndpoint: sraWebsocketAPIUrl,
|
||||||
networkId: options.networkId,
|
chainId: options.chainId,
|
||||||
});
|
});
|
||||||
const swapQuoter = new SwapQuoter(provider, orderbook, options);
|
const swapQuoter = new SwapQuoter(provider, orderbook, options);
|
||||||
return swapQuoter;
|
return swapQuoter;
|
||||||
@ -134,16 +134,16 @@ export class SwapQuoter {
|
|||||||
* @return An instance of SwapQuoter
|
* @return An instance of SwapQuoter
|
||||||
*/
|
*/
|
||||||
constructor(supportedProvider: SupportedProvider, orderbook: Orderbook, options: Partial<SwapQuoterOpts> = {}) {
|
constructor(supportedProvider: SupportedProvider, orderbook: Orderbook, options: Partial<SwapQuoterOpts> = {}) {
|
||||||
const { networkId, expiryBufferMs } = _.merge({}, constants.DEFAULT_SWAP_QUOTER_OPTS, options);
|
const { chainId, expiryBufferMs } = _.merge({}, constants.DEFAULT_SWAP_QUOTER_OPTS, options);
|
||||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||||
assert.isValidOrderbook('orderbook', orderbook);
|
assert.isValidOrderbook('orderbook', orderbook);
|
||||||
assert.isNumber('networkId', networkId);
|
assert.isNumber('chainId', chainId);
|
||||||
assert.isNumber('expiryBufferMs', expiryBufferMs);
|
assert.isNumber('expiryBufferMs', expiryBufferMs);
|
||||||
this.provider = provider;
|
this.provider = provider;
|
||||||
this.orderbook = orderbook;
|
this.orderbook = orderbook;
|
||||||
this.expiryBufferMs = expiryBufferMs;
|
this.expiryBufferMs = expiryBufferMs;
|
||||||
this._contractWrappers = new ContractWrappers(this.provider, {
|
this._contractWrappers = new ContractWrappers(this.provider, {
|
||||||
networkId,
|
chainId,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@ -394,7 +394,7 @@ export class SwapQuoter {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the assetData that represents the ZRX token.
|
* Get the assetData that represents the ZRX token.
|
||||||
* Will throw if ZRX does not exist for the current network.
|
* Will throw if ZRX does not exist for the current chain.
|
||||||
*/
|
*/
|
||||||
private _getZrxTokenAssetDataOrThrow(): string {
|
private _getZrxTokenAssetDataOrThrow(): string {
|
||||||
return assetDataUtils.encodeERC20AssetData(this._contractWrappers.contractAddresses.zrxToken);
|
return assetDataUtils.encodeERC20AssetData(this._contractWrappers.contractAddresses.zrxToken);
|
||||||
|
@ -5,12 +5,12 @@ import { MethodAbi } from 'ethereum-types';
|
|||||||
/**
|
/**
|
||||||
* makerAssetData: The assetData representing the desired makerAsset.
|
* makerAssetData: The assetData representing the desired makerAsset.
|
||||||
* takerAssetData: The assetData representing the desired takerAsset.
|
* takerAssetData: The assetData representing the desired takerAsset.
|
||||||
* networkId: The networkId that the desired orders should be for.
|
* chainId: The chainId that the desired orders should be for.
|
||||||
*/
|
*/
|
||||||
export interface OrderProviderRequest {
|
export interface OrderProviderRequest {
|
||||||
makerAssetData: string;
|
makerAssetData: string;
|
||||||
takerAssetData: string;
|
takerAssetData: string;
|
||||||
networkId: number;
|
chainId: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -148,10 +148,10 @@ export interface SwapQuoteConsumerBase<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* networkId: The networkId that the desired orders should be for.
|
* chainId: The chainId that the desired orders should be for.
|
||||||
*/
|
*/
|
||||||
export interface SwapQuoteConsumerOpts {
|
export interface SwapQuoteConsumerOpts {
|
||||||
networkId: number;
|
chainId: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -271,12 +271,12 @@ export interface SwapQuoteRequestOpts {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* networkId: The ethereum network id. Defaults to 1 (mainnet).
|
* chainId: The ethereum chain 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).
|
* orderRefreshIntervalMs: The interval in ms that getBuyQuoteAsync should trigger an refresh of orders and order states. Defaults to 10000ms (10s).
|
||||||
* expiryBufferMs: The number of seconds to add when calculating whether an order is expired or not. Defaults to 300s (5m).
|
* expiryBufferMs: The number of seconds to add when calculating whether an order is expired or not. Defaults to 300s (5m).
|
||||||
*/
|
*/
|
||||||
export interface SwapQuoterOpts {
|
export interface SwapQuoterOpts {
|
||||||
networkId: number;
|
chainId: number;
|
||||||
orderRefreshIntervalMs: number;
|
orderRefreshIntervalMs: number;
|
||||||
expiryBufferMs: number;
|
expiryBufferMs: number;
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ const expect = chai.expect;
|
|||||||
const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
|
const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
|
||||||
|
|
||||||
const ONE_ETH_IN_WEI = new BigNumber(1000000000000000000);
|
const ONE_ETH_IN_WEI = new BigNumber(1000000000000000000);
|
||||||
const TESTRPC_NETWORK_ID = 50;
|
const TESTRPC_CHAIN_ID = 1337;
|
||||||
const FILLABLE_AMOUNTS = [new BigNumber(3), new BigNumber(2), new BigNumber(5)].map(value =>
|
const FILLABLE_AMOUNTS = [new BigNumber(3), new BigNumber(2), new BigNumber(5)].map(value =>
|
||||||
value.multipliedBy(ONE_ETH_IN_WEI),
|
value.multipliedBy(ONE_ETH_IN_WEI),
|
||||||
);
|
);
|
||||||
@ -48,7 +48,7 @@ describe('ExchangeSwapQuoteConsumer', () => {
|
|||||||
let wethAssetData: string;
|
let wethAssetData: string;
|
||||||
let contractAddresses: ContractAddresses;
|
let contractAddresses: ContractAddresses;
|
||||||
|
|
||||||
const networkId = TESTRPC_NETWORK_ID;
|
const chainId = TESTRPC_CHAIN_ID;
|
||||||
|
|
||||||
let orders: SignedOrder[];
|
let orders: SignedOrder[];
|
||||||
let marketSellSwapQuote: SwapQuote;
|
let marketSellSwapQuote: SwapQuote;
|
||||||
@ -60,7 +60,7 @@ describe('ExchangeSwapQuoteConsumer', () => {
|
|||||||
await blockchainLifecycle.startAsync();
|
await blockchainLifecycle.startAsync();
|
||||||
userAddresses = await web3Wrapper.getAvailableAddressesAsync();
|
userAddresses = await web3Wrapper.getAvailableAddressesAsync();
|
||||||
const config = {
|
const config = {
|
||||||
networkId,
|
chainId,
|
||||||
contractAddresses,
|
contractAddresses,
|
||||||
};
|
};
|
||||||
contractWrappers = new ContractWrappers(provider, config);
|
contractWrappers = new ContractWrappers(provider, config);
|
||||||
@ -83,7 +83,7 @@ describe('ExchangeSwapQuoteConsumer', () => {
|
|||||||
makerFeeAssetData: assetDataUtils.encodeERC20AssetData(contractAddresses.zrxToken),
|
makerFeeAssetData: assetDataUtils.encodeERC20AssetData(contractAddresses.zrxToken),
|
||||||
takerFeeAssetData: assetDataUtils.encodeERC20AssetData(contractAddresses.zrxToken),
|
takerFeeAssetData: assetDataUtils.encodeERC20AssetData(contractAddresses.zrxToken),
|
||||||
exchangeAddress: contractAddresses.exchange,
|
exchangeAddress: contractAddresses.exchange,
|
||||||
chainId: networkId,
|
chainId,
|
||||||
};
|
};
|
||||||
const privateKey = devConstants.TESTRPC_PRIVATE_KEYS[userAddresses.indexOf(makerAddress)];
|
const privateKey = devConstants.TESTRPC_PRIVATE_KEYS[userAddresses.indexOf(makerAddress)];
|
||||||
orderFactory = new OrderFactory(privateKey, defaultOrderParams);
|
orderFactory = new OrderFactory(privateKey, defaultOrderParams);
|
||||||
@ -117,7 +117,7 @@ describe('ExchangeSwapQuoteConsumer', () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
swapQuoteConsumer = new ExchangeSwapQuoteConsumer(provider, {
|
swapQuoteConsumer = new ExchangeSwapQuoteConsumer(provider, {
|
||||||
networkId,
|
chainId,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
|
@ -25,7 +25,7 @@ const expect = chai.expect;
|
|||||||
const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
|
const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
|
||||||
|
|
||||||
const ONE_ETH_IN_WEI = new BigNumber(1000000000000000000);
|
const ONE_ETH_IN_WEI = new BigNumber(1000000000000000000);
|
||||||
const TESTRPC_NETWORK_ID = 50;
|
const TESTRPC_CHAIN_ID = 1337;
|
||||||
const MARKET_OPERATION = MarketOperation.Sell;
|
const MARKET_OPERATION = MarketOperation.Sell;
|
||||||
const FILLABLE_AMOUNTS = [new BigNumber(2), new BigNumber(3), new BigNumber(5)].map(value =>
|
const FILLABLE_AMOUNTS = [new BigNumber(2), new BigNumber(3), new BigNumber(5)].map(value =>
|
||||||
value.multipliedBy(ONE_ETH_IN_WEI),
|
value.multipliedBy(ONE_ETH_IN_WEI),
|
||||||
@ -53,13 +53,13 @@ describe('ForwarderSwapQuoteConsumer', () => {
|
|||||||
let swapQuoteConsumer: ForwarderSwapQuoteConsumer;
|
let swapQuoteConsumer: ForwarderSwapQuoteConsumer;
|
||||||
let erc20ProxyAddress: string;
|
let erc20ProxyAddress: string;
|
||||||
|
|
||||||
const networkId = TESTRPC_NETWORK_ID;
|
const chainId = TESTRPC_CHAIN_ID;
|
||||||
before(async () => {
|
before(async () => {
|
||||||
contractAddresses = await migrateOnceAsync();
|
contractAddresses = await migrateOnceAsync();
|
||||||
await blockchainLifecycle.startAsync();
|
await blockchainLifecycle.startAsync();
|
||||||
userAddresses = await web3Wrapper.getAvailableAddressesAsync();
|
userAddresses = await web3Wrapper.getAvailableAddressesAsync();
|
||||||
const config = {
|
const config = {
|
||||||
networkId,
|
chainId,
|
||||||
contractAddresses,
|
contractAddresses,
|
||||||
};
|
};
|
||||||
contractWrappers = new ContractWrappers(provider, config);
|
contractWrappers = new ContractWrappers(provider, config);
|
||||||
@ -117,7 +117,7 @@ describe('ForwarderSwapQuoteConsumer', () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
swapQuoteConsumer = new ForwarderSwapQuoteConsumer(provider, {
|
swapQuoteConsumer = new ForwarderSwapQuoteConsumer(provider, {
|
||||||
networkId,
|
chainId,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
|
@ -19,7 +19,7 @@ const expect = chai.expect;
|
|||||||
const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
|
const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
|
||||||
|
|
||||||
const ONE_ETH_IN_WEI = new BigNumber(1000000000000000000);
|
const ONE_ETH_IN_WEI = new BigNumber(1000000000000000000);
|
||||||
const TESTRPC_NETWORK_ID = 50;
|
const TESTRPC_CHAIN_ID = 1337;
|
||||||
const FILLABLE_AMOUNTS = [new BigNumber(3), new BigNumber(2), new BigNumber(5)].map(value =>
|
const FILLABLE_AMOUNTS = [new BigNumber(3), new BigNumber(2), new BigNumber(5)].map(value =>
|
||||||
value.multipliedBy(ONE_ETH_IN_WEI),
|
value.multipliedBy(ONE_ETH_IN_WEI),
|
||||||
);
|
);
|
||||||
@ -41,7 +41,7 @@ describe('SwapQuoteConsumer', () => {
|
|||||||
let wethAssetData: string;
|
let wethAssetData: string;
|
||||||
let contractAddresses: ContractAddresses;
|
let contractAddresses: ContractAddresses;
|
||||||
|
|
||||||
const networkId = TESTRPC_NETWORK_ID;
|
const chainId = TESTRPC_CHAIN_ID;
|
||||||
|
|
||||||
let orders: SignedOrder[];
|
let orders: SignedOrder[];
|
||||||
let marketSellSwapQuote: SwapQuote;
|
let marketSellSwapQuote: SwapQuote;
|
||||||
@ -53,7 +53,7 @@ describe('SwapQuoteConsumer', () => {
|
|||||||
await blockchainLifecycle.startAsync();
|
await blockchainLifecycle.startAsync();
|
||||||
userAddresses = await web3Wrapper.getAvailableAddressesAsync();
|
userAddresses = await web3Wrapper.getAvailableAddressesAsync();
|
||||||
const config = {
|
const config = {
|
||||||
networkId,
|
chainId,
|
||||||
contractAddresses,
|
contractAddresses,
|
||||||
};
|
};
|
||||||
contractWrappers = new ContractWrappers(provider, config);
|
contractWrappers = new ContractWrappers(provider, config);
|
||||||
@ -104,7 +104,7 @@ describe('SwapQuoteConsumer', () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
swapQuoteConsumer = new SwapQuoteConsumer(provider, {
|
swapQuoteConsumer = new SwapQuoteConsumer(provider, {
|
||||||
networkId,
|
chainId,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
|
@ -19,7 +19,7 @@ const expect = chai.expect;
|
|||||||
const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
|
const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
|
||||||
|
|
||||||
const ONE_ETH_IN_WEI = new BigNumber(1000000000000000000);
|
const ONE_ETH_IN_WEI = new BigNumber(1000000000000000000);
|
||||||
const TESTRPC_NETWORK_ID = 50;
|
const TESTRPC_CHAIN_ID = 1337;
|
||||||
const FILLABLE_AMOUNTS = [new BigNumber(2), new BigNumber(3), new BigNumber(5)].map(value =>
|
const FILLABLE_AMOUNTS = [new BigNumber(2), new BigNumber(3), new BigNumber(5)].map(value =>
|
||||||
value.multipliedBy(ONE_ETH_IN_WEI),
|
value.multipliedBy(ONE_ETH_IN_WEI),
|
||||||
);
|
);
|
||||||
@ -40,13 +40,13 @@ describe('swapQuoteConsumerUtils', () => {
|
|||||||
let contractAddresses: ContractAddresses;
|
let contractAddresses: ContractAddresses;
|
||||||
let swapQuoteConsumer: SwapQuoteConsumer;
|
let swapQuoteConsumer: SwapQuoteConsumer;
|
||||||
|
|
||||||
const networkId = TESTRPC_NETWORK_ID;
|
const chainId = TESTRPC_CHAIN_ID;
|
||||||
before(async () => {
|
before(async () => {
|
||||||
contractAddresses = await migrateOnceAsync();
|
contractAddresses = await migrateOnceAsync();
|
||||||
await blockchainLifecycle.startAsync();
|
await blockchainLifecycle.startAsync();
|
||||||
userAddresses = await web3Wrapper.getAvailableAddressesAsync();
|
userAddresses = await web3Wrapper.getAvailableAddressesAsync();
|
||||||
const config = {
|
const config = {
|
||||||
networkId,
|
chainId,
|
||||||
contractAddresses,
|
contractAddresses,
|
||||||
};
|
};
|
||||||
contractWrappers = new ContractWrappers(provider, config);
|
contractWrappers = new ContractWrappers(provider, config);
|
||||||
@ -59,7 +59,7 @@ describe('swapQuoteConsumerUtils', () => {
|
|||||||
];
|
];
|
||||||
|
|
||||||
swapQuoteConsumer = new SwapQuoteConsumer(provider, {
|
swapQuoteConsumer = new SwapQuoteConsumer(provider, {
|
||||||
networkId,
|
chainId,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
after(async () => {
|
after(async () => {
|
||||||
|
@ -1,4 +1,13 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"version": "6.0.0-beta.0",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "All references to network ID have been removed, and references to chain ID have been introduced instead",
|
||||||
|
"pr": 2313
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"version": "5.1.0-beta.0",
|
"version": "5.1.0-beta.0",
|
||||||
"changes": [
|
"changes": [
|
||||||
|
@ -53,7 +53,7 @@ export class HttpClient {
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Retrieve assetData pair info from the API
|
* Retrieve assetData pair info from the API
|
||||||
* @param requestOpts Options specifying assetData information to retrieve, page information, and network id.
|
* @param requestOpts Options specifying assetData information to retrieve, page information, and chain id.
|
||||||
* @return The resulting AssetPairsResponse that match the request
|
* @return The resulting AssetPairsResponse that match the request
|
||||||
*/
|
*/
|
||||||
public async getAssetPairsAsync(
|
public async getAssetPairsAsync(
|
||||||
@ -73,7 +73,7 @@ export class HttpClient {
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Retrieve orders from the API
|
* Retrieve orders from the API
|
||||||
* @param requestOpts Options specifying orders to retrieve and page information, page information, and network id.
|
* @param requestOpts Options specifying orders to retrieve and page information, page information, and chain id.
|
||||||
* @return The resulting OrdersResponse that match the request
|
* @return The resulting OrdersResponse that match the request
|
||||||
*/
|
*/
|
||||||
public async getOrdersAsync(
|
public async getOrdersAsync(
|
||||||
@ -111,7 +111,7 @@ export class HttpClient {
|
|||||||
/**
|
/**
|
||||||
* Retrieve an orderbook from the API
|
* Retrieve an orderbook from the API
|
||||||
* @param request An OrderbookRequest instance describing the specific orderbook to retrieve
|
* @param request An OrderbookRequest instance describing the specific orderbook to retrieve
|
||||||
* @param requestOpts Options specifying page information, and network id.
|
* @param requestOpts Options specifying page information, and chain id.
|
||||||
* @return The resulting OrderbookResponse that matches the request
|
* @return The resulting OrderbookResponse that matches the request
|
||||||
*/
|
*/
|
||||||
public async getOrderbookAsync(
|
public async getOrderbookAsync(
|
||||||
@ -133,7 +133,7 @@ export class HttpClient {
|
|||||||
/**
|
/**
|
||||||
* Retrieve fee information from the API
|
* Retrieve fee information from the API
|
||||||
* @param request A OrderConfigRequest instance describing the specific fees to retrieve
|
* @param request A OrderConfigRequest instance describing the specific fees to retrieve
|
||||||
* @param requestOpts Options specifying network id.
|
* @param requestOpts Options specifying chain id.
|
||||||
* @return The resulting OrderConfigResponse that matches the request
|
* @return The resulting OrderConfigResponse that matches the request
|
||||||
*/
|
*/
|
||||||
public async getOrderConfigAsync(
|
public async getOrderConfigAsync(
|
||||||
@ -154,7 +154,7 @@ export class HttpClient {
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Retrieve the list of fee recipient addresses used by the relayer.
|
* Retrieve the list of fee recipient addresses used by the relayer.
|
||||||
* @param requestOpts Options specifying page information, and network id.
|
* @param requestOpts Options specifying page information, and chain id.
|
||||||
* @return The resulting FeeRecipientsResponse
|
* @return The resulting FeeRecipientsResponse
|
||||||
*/
|
*/
|
||||||
public async getFeeRecipientsAsync(requestOpts?: RequestOpts & PagedRequestOpts): Promise<FeeRecipientsResponse> {
|
public async getFeeRecipientsAsync(requestOpts?: RequestOpts & PagedRequestOpts): Promise<FeeRecipientsResponse> {
|
||||||
@ -172,7 +172,7 @@ export class HttpClient {
|
|||||||
/**
|
/**
|
||||||
* Submit a signed order to the API
|
* Submit a signed order to the API
|
||||||
* @param signedOrder A SignedOrder instance to submit
|
* @param signedOrder A SignedOrder instance to submit
|
||||||
* @param requestOpts Options specifying network id.
|
* @param requestOpts Options specifying chain id.
|
||||||
*/
|
*/
|
||||||
public async submitOrderAsync(signedOrder: SignedOrder, requestOpts?: RequestOpts): Promise<void> {
|
public async submitOrderAsync(signedOrder: SignedOrder, requestOpts?: RequestOpts): Promise<void> {
|
||||||
assert.doesConformToSchema('signedOrder', signedOrder, schemas.signedOrderSchema);
|
assert.doesConformToSchema('signedOrder', signedOrder, schemas.signedOrderSchema);
|
||||||
|
@ -53,9 +53,9 @@ describe('HttpClient', () => {
|
|||||||
assetDataA: assetData,
|
assetDataA: assetData,
|
||||||
page: 3,
|
page: 3,
|
||||||
perPage: 50,
|
perPage: 50,
|
||||||
networkdId: 42,
|
chainId: 42,
|
||||||
};
|
};
|
||||||
const urlWithQuery = `${url}?assetDataA=${assetData}&networkdId=42&page=3&perPage=50`;
|
const urlWithQuery = `${url}?assetDataA=${assetData}&chainId=42&page=3&perPage=50`;
|
||||||
fetchMock.get(urlWithQuery, assetDataPairsResponseJSON);
|
fetchMock.get(urlWithQuery, assetDataPairsResponseJSON);
|
||||||
const assetDataPairs = await relayerClient.getAssetPairsAsync(assetPairsRequestOpts);
|
const assetDataPairs = await relayerClient.getAssetPairsAsync(assetPairsRequestOpts);
|
||||||
expect(assetDataPairs).to.be.deep.equal(assetDataPairsResponse);
|
expect(assetDataPairs).to.be.deep.equal(assetDataPairsResponse);
|
||||||
@ -78,9 +78,9 @@ describe('HttpClient', () => {
|
|||||||
assetDataAddress,
|
assetDataAddress,
|
||||||
page: 3,
|
page: 3,
|
||||||
perPage: 50,
|
perPage: 50,
|
||||||
networkdId: 42,
|
chainId: 42,
|
||||||
};
|
};
|
||||||
const urlWithQuery = `${url}?assetDataAddress=${assetDataAddress}&networkdId=42&page=3&perPage=50`;
|
const urlWithQuery = `${url}?assetDataAddress=${assetDataAddress}&chainId=42&page=3&perPage=50`;
|
||||||
fetchMock.get(urlWithQuery, ordersResponseJSON);
|
fetchMock.get(urlWithQuery, ordersResponseJSON);
|
||||||
const orders = await relayerClient.getOrdersAsync(ordersRequest);
|
const orders = await relayerClient.getOrdersAsync(ordersRequest);
|
||||||
expect(orders).to.be.deep.equal(ordersResponse);
|
expect(orders).to.be.deep.equal(ordersResponse);
|
||||||
@ -120,12 +120,12 @@ describe('HttpClient', () => {
|
|||||||
it('gets orderbook with specified page options', async () => {
|
it('gets orderbook with specified page options', async () => {
|
||||||
const urlWithQuery = `${url}?baseAssetData=${
|
const urlWithQuery = `${url}?baseAssetData=${
|
||||||
request.baseAssetData
|
request.baseAssetData
|
||||||
}&networkId=42&page=3&perPage=50"eAssetData=${request.quoteAssetData}`;
|
}&chainId=42&page=3&perPage=50"eAssetData=${request.quoteAssetData}`;
|
||||||
fetchMock.get(urlWithQuery, orderbookJSON);
|
fetchMock.get(urlWithQuery, orderbookJSON);
|
||||||
const pagedRequestOptions = {
|
const pagedRequestOptions = {
|
||||||
page: 3,
|
page: 3,
|
||||||
perPage: 50,
|
perPage: 50,
|
||||||
networkId: 42,
|
chainId: 42,
|
||||||
};
|
};
|
||||||
const orderbook = await relayerClient.getOrderbookAsync(request, pagedRequestOptions);
|
const orderbook = await relayerClient.getOrderbookAsync(request, pagedRequestOptions);
|
||||||
expect(orderbook).to.be.deep.equal(orderbookResponse);
|
expect(orderbook).to.be.deep.equal(orderbookResponse);
|
||||||
@ -175,12 +175,12 @@ describe('HttpClient', () => {
|
|||||||
expect(feeRecipients).to.be.deep.equal(feeRecipientsResponse);
|
expect(feeRecipients).to.be.deep.equal(feeRecipientsResponse);
|
||||||
});
|
});
|
||||||
it('gets fee recipient with specified page options', async () => {
|
it('gets fee recipient with specified page options', async () => {
|
||||||
const urlWithQuery = `${url}?networkId=42&page=3&perPage=50`;
|
const urlWithQuery = `${url}?chainId=42&page=3&perPage=50`;
|
||||||
fetchMock.get(urlWithQuery, feeRecipientsResponseJSON);
|
fetchMock.get(urlWithQuery, feeRecipientsResponseJSON);
|
||||||
const pagedRequestOptions = {
|
const pagedRequestOptions = {
|
||||||
page: 3,
|
page: 3,
|
||||||
perPage: 50,
|
perPage: 50,
|
||||||
networkId: 42,
|
chainId: 42,
|
||||||
};
|
};
|
||||||
const feeRecipients = await relayerClient.getFeeRecipientsAsync(pagedRequestOptions);
|
const feeRecipients = await relayerClient.getFeeRecipientsAsync(pagedRequestOptions);
|
||||||
expect(feeRecipients).to.be.deep.equal(feeRecipientsResponse);
|
expect(feeRecipients).to.be.deep.equal(feeRecipientsResponse);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"version": "3.4.0-beta.0",
|
"version": "4.0.0-beta.0",
|
||||||
"changes": [
|
"changes": [
|
||||||
{
|
{
|
||||||
"note": "Remove `readOnlyProxy` from addresses interface",
|
"note": "Remove `readOnlyProxy` from addresses interface",
|
||||||
@ -13,6 +13,10 @@
|
|||||||
{
|
{
|
||||||
"note": "Update `exchange`, `staking`, `stakingProxy`, `zeroExGovernor`, `assetProxyOwner`, and `erc20BridgeProxy` addresses for each tesnet",
|
"note": "Update `exchange`, `staking`, `stakingProxy`, `zeroExGovernor`, `assetProxyOwner`, and `erc20BridgeProxy` addresses for each tesnet",
|
||||||
"pr": 2296
|
"pr": 2296
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"note": "Contract addresses are no longer indexed by network ID. Now they're indexed by chain ID.",
|
||||||
|
"pr": 2313
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -91,7 +91,7 @@
|
|||||||
"stakingProxy": "0xbab9145f1d57cd4bb0c9aa2d1ece0a5b6e734d34",
|
"stakingProxy": "0xbab9145f1d57cd4bb0c9aa2d1ece0a5b6e734d34",
|
||||||
"erc20BridgeProxy": "0xfb2dd2a1366de37f7241c83d47da58fd503e2c64"
|
"erc20BridgeProxy": "0xfb2dd2a1366de37f7241c83d47da58fd503e2c64"
|
||||||
},
|
},
|
||||||
"50": {
|
"1337": {
|
||||||
"erc20Proxy": "0x1dc4c1cefef38a777b15aa20260a54e584b16c48",
|
"erc20Proxy": "0x1dc4c1cefef38a777b15aa20260a54e584b16c48",
|
||||||
"erc721Proxy": "0x1d7022f5b17d2f8b695918fb48fa1089c9f85401",
|
"erc721Proxy": "0x1d7022f5b17d2f8b695918fb48fa1089c9f85401",
|
||||||
"erc1155Proxy": "0x6a4a62e5a7ed13c361b176a5f62c2ee620ac0df8",
|
"erc1155Proxy": "0x6a4a62e5a7ed13c361b176a5f62c2ee620ac0df8",
|
||||||
|
@ -26,27 +26,27 @@ export interface ContractAddresses {
|
|||||||
erc20BridgeProxy: string;
|
erc20BridgeProxy: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum NetworkId {
|
export enum ChainId {
|
||||||
Mainnet = 1,
|
Mainnet = 1,
|
||||||
Ropsten = 3,
|
Ropsten = 3,
|
||||||
Rinkeby = 4,
|
Rinkeby = 4,
|
||||||
Kovan = 42,
|
Kovan = 42,
|
||||||
Ganache = 50,
|
Ganache = 1337,
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to get addresses of contracts that have been deployed to either the
|
* 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
|
* Ethereum mainnet or a supported testnet. Throws if there are no known
|
||||||
* contracts deployed on the corresponding network.
|
* contracts deployed on the corresponding chain.
|
||||||
* @param networkId The desired networkId.
|
* @param chainId The desired chainId.
|
||||||
* @returns The set of addresses for contracts which have been deployed on the
|
* @returns The set of addresses for contracts which have been deployed on the
|
||||||
* given networkId.
|
* given chainId.
|
||||||
*/
|
*/
|
||||||
export function getContractAddressesForNetworkOrThrow(networkId: NetworkId): ContractAddresses {
|
export function getContractAddressesForChainOrThrow(chainId: ChainId): ContractAddresses {
|
||||||
const networkToAddresses: { [networkId: number]: ContractAddresses } = addresses;
|
const chainToAddresses: { [chainId: number]: ContractAddresses } = addresses;
|
||||||
|
|
||||||
if (networkToAddresses[networkId] === undefined) {
|
if (chainToAddresses[chainId] === undefined) {
|
||||||
throw new Error(`Unknown network id (${networkId}). No known 0x contracts have been deployed on this network.`);
|
throw new Error(`Unknown chain id (${chainId}). No known 0x contracts have been deployed on this chain.`);
|
||||||
}
|
}
|
||||||
return networkToAddresses[networkId];
|
return chainToAddresses[chainId];
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,13 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"version": "13.0.0-beta.0",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "All references to network ID have been removed, and references to chain ID have been introduced instead",
|
||||||
|
"pr": 2313
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"version": "12.2.0-beta.0",
|
"version": "12.2.0-beta.0",
|
||||||
"changes": [
|
"changes": [
|
||||||
|
@ -38,7 +38,7 @@ import { _getDefaultContractAddresses } from './utils/contract_addresses';
|
|||||||
*/
|
*/
|
||||||
export class ContractWrappers {
|
export class ContractWrappers {
|
||||||
/**
|
/**
|
||||||
* An index of the default contract addresses for this network.
|
* An index of the default contract addresses for this chain.
|
||||||
*/
|
*/
|
||||||
public contractAddresses: ContractAddresses;
|
public contractAddresses: ContractAddresses;
|
||||||
/**
|
/**
|
||||||
@ -113,7 +113,7 @@ export class ContractWrappers {
|
|||||||
});
|
});
|
||||||
const contractAddresses =
|
const contractAddresses =
|
||||||
config.contractAddresses === undefined
|
config.contractAddresses === undefined
|
||||||
? _getDefaultContractAddresses(config.networkId)
|
? _getDefaultContractAddresses(config.chainId)
|
||||||
: config.contractAddresses;
|
: config.contractAddresses;
|
||||||
this.erc20Proxy = new ERC20ProxyContract(contractAddresses.erc20Proxy, this.getProvider());
|
this.erc20Proxy = new ERC20ProxyContract(contractAddresses.erc20Proxy, this.getProvider());
|
||||||
this.erc721Proxy = new ERC721ProxyContract(contractAddresses.erc721Proxy, this.getProvider());
|
this.erc721Proxy = new ERC721ProxyContract(contractAddresses.erc721Proxy, this.getProvider());
|
||||||
@ -125,7 +125,7 @@ export class ContractWrappers {
|
|||||||
this.devUtils = new DevUtilsContract(contractAddresses.devUtils, this.getProvider());
|
this.devUtils = new DevUtilsContract(contractAddresses.devUtils, this.getProvider());
|
||||||
this.coordinator = new CoordinatorWrapper(
|
this.coordinator = new CoordinatorWrapper(
|
||||||
this.getProvider(),
|
this.getProvider(),
|
||||||
config.networkId,
|
config.chainId,
|
||||||
contractAddresses.coordinator,
|
contractAddresses.coordinator,
|
||||||
contractAddresses.exchange,
|
contractAddresses.exchange,
|
||||||
contractAddresses.coordinatorRegistry,
|
contractAddresses.coordinatorRegistry,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { getContractAddressesForNetworkOrThrow } from '@0x/contract-addresses';
|
import { getContractAddressesForChainOrThrow } from '@0x/contract-addresses';
|
||||||
import { Coordinator } from '@0x/contract-artifacts';
|
import { Coordinator } from '@0x/contract-artifacts';
|
||||||
import { schemas } from '@0x/json-schemas';
|
import { schemas } from '@0x/json-schemas';
|
||||||
import { generatePseudoRandomSalt, signatureUtils } from '@0x/order-utils';
|
import { generatePseudoRandomSalt, signatureUtils } from '@0x/order-utils';
|
||||||
@ -32,7 +32,7 @@ import { getAbiEncodedTransactionData } from './utils/getAbiEncodedTransactionDa
|
|||||||
*/
|
*/
|
||||||
export class CoordinatorWrapper {
|
export class CoordinatorWrapper {
|
||||||
public abi: ContractAbi = Coordinator.compilerOutput.abi;
|
public abi: ContractAbi = Coordinator.compilerOutput.abi;
|
||||||
public networkId: number;
|
public chainId: number;
|
||||||
public address: string;
|
public address: string;
|
||||||
public exchangeAddress: string;
|
public exchangeAddress: string;
|
||||||
public registryAddress: string;
|
public registryAddress: string;
|
||||||
@ -45,23 +45,23 @@ export class CoordinatorWrapper {
|
|||||||
/**
|
/**
|
||||||
* Instantiate CoordinatorWrapper
|
* Instantiate CoordinatorWrapper
|
||||||
* @param web3Wrapper Web3Wrapper instance to use.
|
* @param web3Wrapper Web3Wrapper instance to use.
|
||||||
* @param networkId Desired networkId.
|
* @param chainId Desired chainId.
|
||||||
* @param address The address of the Coordinator contract. If undefined, will
|
* @param address The address of the Coordinator contract. If undefined, will
|
||||||
* default to the known address corresponding to the networkId.
|
* default to the known address corresponding to the chainId.
|
||||||
* @param exchangeAddress The address of the Exchange contract. If undefined, will
|
* @param exchangeAddress The address of the Exchange contract. If undefined, will
|
||||||
* default to the known address corresponding to the networkId.
|
* default to the known address corresponding to the chainId.
|
||||||
* @param registryAddress The address of the CoordinatorRegistry contract. If undefined, will
|
* @param registryAddress The address of the CoordinatorRegistry contract. If undefined, will
|
||||||
* default to the known address corresponding to the networkId.
|
* default to the known address corresponding to the chainId.
|
||||||
*/
|
*/
|
||||||
constructor(
|
constructor(
|
||||||
provider: SupportedProvider,
|
provider: SupportedProvider,
|
||||||
networkId: number,
|
chainId: number,
|
||||||
address?: string,
|
address?: string,
|
||||||
exchangeAddress?: string,
|
exchangeAddress?: string,
|
||||||
registryAddress?: string,
|
registryAddress?: string,
|
||||||
) {
|
) {
|
||||||
this.networkId = networkId;
|
this.chainId = chainId;
|
||||||
const contractAddresses = getContractAddressesForNetworkOrThrow(networkId);
|
const contractAddresses = getContractAddressesForChainOrThrow(chainId);
|
||||||
this.address = address === undefined ? contractAddresses.coordinator : address;
|
this.address = address === undefined ? contractAddresses.coordinator : address;
|
||||||
this.exchangeAddress = exchangeAddress === undefined ? contractAddresses.coordinator : exchangeAddress;
|
this.exchangeAddress = exchangeAddress === undefined ? contractAddresses.coordinator : exchangeAddress;
|
||||||
this.registryAddress = registryAddress === undefined ? contractAddresses.coordinatorRegistry : registryAddress;
|
this.registryAddress = registryAddress === undefined ? contractAddresses.coordinatorRegistry : registryAddress;
|
||||||
@ -711,7 +711,7 @@ export class CoordinatorWrapper {
|
|||||||
signedTransaction,
|
signedTransaction,
|
||||||
txOrigin,
|
txOrigin,
|
||||||
};
|
};
|
||||||
const response = await fetchAsync(`${endpoint}/v1/request_transaction?networkId=${this.networkId}`, {
|
const response = await fetchAsync(`${endpoint}/v1/request_transaction?chainId=${this.chainId}`, {
|
||||||
body: JSON.stringify(requestPayload),
|
body: JSON.stringify(requestPayload),
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
|
@ -103,7 +103,7 @@ export {
|
|||||||
LogWithDecodedArgs,
|
LogWithDecodedArgs,
|
||||||
CompilerOpts,
|
CompilerOpts,
|
||||||
StandardContractOutput,
|
StandardContractOutput,
|
||||||
ContractNetworks,
|
ContractChains,
|
||||||
EventParameter,
|
EventParameter,
|
||||||
TupleDataItem,
|
TupleDataItem,
|
||||||
TxDataPayable,
|
TxDataPayable,
|
||||||
@ -116,7 +116,7 @@ export {
|
|||||||
LogEntry,
|
LogEntry,
|
||||||
RawLog,
|
RawLog,
|
||||||
CompilerSettings,
|
CompilerSettings,
|
||||||
ContractNetworkData,
|
ContractChainData,
|
||||||
EIP1193Event,
|
EIP1193Event,
|
||||||
JSONRPCRequestPayload,
|
JSONRPCRequestPayload,
|
||||||
JSONRPCErrorCallback,
|
JSONRPCErrorCallback,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
export const ContractWrappersConfigSchema = {
|
export const ContractWrappersConfigSchema = {
|
||||||
id: '/ContractWrappersConfig',
|
id: '/ContractWrappersConfig',
|
||||||
properties: {
|
properties: {
|
||||||
networkId: {
|
chainId: {
|
||||||
type: 'number',
|
type: 'number',
|
||||||
},
|
},
|
||||||
gasPrice: { $ref: '/numberSchema' },
|
gasPrice: { $ref: '/numberSchema' },
|
||||||
@ -21,5 +21,5 @@ export const ContractWrappersConfigSchema = {
|
|||||||
blockPollingIntervalMs: { type: 'number' },
|
blockPollingIntervalMs: { type: 'number' },
|
||||||
},
|
},
|
||||||
type: 'object',
|
type: 'object',
|
||||||
required: ['networkId'],
|
required: ['chainId'],
|
||||||
};
|
};
|
||||||
|
@ -13,7 +13,7 @@ export enum ForwarderError {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export enum ContractError {
|
export enum ContractError {
|
||||||
ContractNotDeployedOnNetwork = 'CONTRACT_NOT_DEPLOYED_ON_NETWORK',
|
ContractNotDeployedOnChain = 'CONTRACT_NOT_DEPLOYED_ON_CHAIN',
|
||||||
InsufficientAllowanceForTransfer = 'INSUFFICIENT_ALLOWANCE_FOR_TRANSFER',
|
InsufficientAllowanceForTransfer = 'INSUFFICIENT_ALLOWANCE_FOR_TRANSFER',
|
||||||
InsufficientBalanceForTransfer = 'INSUFFICIENT_BALANCE_FOR_TRANSFER',
|
InsufficientBalanceForTransfer = 'INSUFFICIENT_BALANCE_FOR_TRANSFER',
|
||||||
InsufficientEthBalanceForDeposit = 'INSUFFICIENT_ETH_BALANCE_FOR_DEPOSIT',
|
InsufficientEthBalanceForDeposit = 'INSUFFICIENT_ETH_BALANCE_FOR_DEPOSIT',
|
||||||
@ -28,13 +28,13 @@ export enum ContractError {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* networkId: The id of the underlying ethereum network your provider is connected to. (1-mainnet, 3-ropsten, 4-rinkeby, 42-kovan, 50-testrpc)
|
* chainId: The id of the underlying ethereum chain your provider is connected to. (1-mainnet, 3-ropsten, 4-rinkeby, 42-kovan, 1337-testrpc)
|
||||||
* gasPrice: Gas price to use with every transaction
|
* gasPrice: Gas price to use with every transaction
|
||||||
* contractAddresses: The address of all contracts to use. Defaults to the known addresses based on networkId.
|
* contractAddresses: The address of all contracts to use. Defaults to the known addresses based on chainId.
|
||||||
* blockPollingIntervalMs: The interval to use for block polling in event watching methods (defaults to 1000)
|
* blockPollingIntervalMs: The interval to use for block polling in event watching methods (defaults to 1000)
|
||||||
*/
|
*/
|
||||||
export interface ContractWrappersConfig {
|
export interface ContractWrappersConfig {
|
||||||
networkId: number;
|
chainId: number;
|
||||||
gasPrice?: BigNumber;
|
gasPrice?: BigNumber;
|
||||||
contractAddresses?: ContractAddresses;
|
contractAddresses?: ContractAddresses;
|
||||||
blockPollingIntervalMs?: number;
|
blockPollingIntervalMs?: number;
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
import { ContractAddresses, getContractAddressesForNetworkOrThrow, NetworkId } from '@0x/contract-addresses';
|
import { ChainId, ContractAddresses, getContractAddressesForChainOrThrow } from '@0x/contract-addresses';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the default contract addresses for the given networkId or throws with
|
* Returns the default contract addresses for the given chainId or throws with
|
||||||
* a context-specific error message if the networkId is not recognized.
|
* a context-specific error message if the chainId is not recognized.
|
||||||
*/
|
*/
|
||||||
export function _getDefaultContractAddresses(networkId: number): ContractAddresses {
|
export function _getDefaultContractAddresses(chainId: number): ContractAddresses {
|
||||||
if (!(networkId in NetworkId)) {
|
if (!(chainId in ChainId)) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`No default contract addresses found for the given network id (${networkId}). If you want to use ContractWrappers on this network, you must manually pass in the contract address(es) to the constructor.`,
|
`No default contract addresses found for the given chain id (${chainId}). If you want to use ContractWrappers on this chain, you must manually pass in the contract address(es) to the constructor.`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return getContractAddressesForNetworkOrThrow(networkId);
|
return getContractAddressesForChainOrThrow(chainId);
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
export enum ContractError {
|
export enum ContractError {
|
||||||
ContractNotDeployedOnNetwork = 'CONTRACT_NOT_DEPLOYED_ON_NETWORK',
|
ContractNotDeployedOnChain = 'CONTRACT_NOT_DEPLOYED_ON_CHAIN',
|
||||||
InsufficientAllowanceForTransfer = 'INSUFFICIENT_ALLOWANCE_FOR_TRANSFER',
|
InsufficientAllowanceForTransfer = 'INSUFFICIENT_ALLOWANCE_FOR_TRANSFER',
|
||||||
InsufficientBalanceForTransfer = 'INSUFFICIENT_BALANCE_FOR_TRANSFER',
|
InsufficientBalanceForTransfer = 'INSUFFICIENT_BALANCE_FOR_TRANSFER',
|
||||||
InsufficientEthBalanceForDeposit = 'INSUFFICIENT_ETH_BALANCE_FOR_DEPOSIT',
|
InsufficientEthBalanceForDeposit = 'INSUFFICIENT_ETH_BALANCE_FOR_DEPOSIT',
|
||||||
|
@ -23,7 +23,7 @@ describe('ABI Decoding Calldata', () => {
|
|||||||
const defaultERC20MakerAssetAddress = addressUtils.generatePseudoRandomAddress();
|
const defaultERC20MakerAssetAddress = addressUtils.generatePseudoRandomAddress();
|
||||||
const matchOrdersSignature =
|
const matchOrdersSignature =
|
||||||
'matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes),bytes,bytes)';
|
'matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes),bytes,bytes)';
|
||||||
const chainId: number = constants.TESTRPC_NETWORK_ID;
|
const chainId: number = constants.TESTRPC_CHAIN_ID;
|
||||||
let signedOrderLeft: SignedOrder;
|
let signedOrderLeft: SignedOrder;
|
||||||
let signedOrderRight: SignedOrder;
|
let signedOrderRight: SignedOrder;
|
||||||
let orderLeft = {};
|
let orderLeft = {};
|
||||||
@ -85,7 +85,7 @@ describe('ABI Decoding Calldata', () => {
|
|||||||
contractAddresses = await migrateOnceAsync();
|
contractAddresses = await migrateOnceAsync();
|
||||||
await blockchainLifecycle.startAsync();
|
await blockchainLifecycle.startAsync();
|
||||||
const config = {
|
const config = {
|
||||||
networkId: constants.TESTRPC_NETWORK_ID,
|
chainId: constants.TESTRPC_CHAIN_ID,
|
||||||
contractAddresses,
|
contractAddresses,
|
||||||
blockPollingIntervalMs: 10,
|
blockPollingIntervalMs: 10,
|
||||||
};
|
};
|
||||||
|
@ -65,7 +65,7 @@ describe.skip('CoordinatorWrapper', () => {
|
|||||||
const contractAddresses = await migrateOnceAsync();
|
const contractAddresses = await migrateOnceAsync();
|
||||||
await blockchainLifecycle.startAsync();
|
await blockchainLifecycle.startAsync();
|
||||||
const config = {
|
const config = {
|
||||||
networkId: constants.TESTRPC_NETWORK_ID,
|
chainId: constants.TESTRPC_CHAIN_ID,
|
||||||
contractAddresses,
|
contractAddresses,
|
||||||
blockPollingIntervalMs: 10,
|
blockPollingIntervalMs: 10,
|
||||||
};
|
};
|
||||||
@ -111,7 +111,8 @@ describe.skip('CoordinatorWrapper', () => {
|
|||||||
const coordinatorServerConfigs = {
|
const coordinatorServerConfigs = {
|
||||||
HTTP_PORT: 3000, // Only used in default instantiation in 0x-coordinator-server/server.js; not used here
|
HTTP_PORT: 3000, // Only used in default instantiation in 0x-coordinator-server/server.js; not used here
|
||||||
NETWORK_ID_TO_SETTINGS: {
|
NETWORK_ID_TO_SETTINGS: {
|
||||||
[config.networkId]: {
|
// TODO: change to CHAIN_ID_TO_SETTINGS when @0x/coordinator-server is ready
|
||||||
|
[config.chainId]: {
|
||||||
FEE_RECIPIENTS: [
|
FEE_RECIPIENTS: [
|
||||||
{
|
{
|
||||||
ADDRESS: feeRecipientAddressOne,
|
ADDRESS: feeRecipientAddressOne,
|
||||||
@ -138,7 +139,8 @@ describe.skip('CoordinatorWrapper', () => {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
NETWORK_ID_TO_CONTRACT_ADDRESSES: {
|
NETWORK_ID_TO_CONTRACT_ADDRESSES: {
|
||||||
[config.networkId]: contractAddresses,
|
// TODO: change to CHAIN_ID_TO_CONTRACT_ADDRESSES when @0x/coordinator-server is ready
|
||||||
|
[config.chainId]: contractAddresses,
|
||||||
},
|
},
|
||||||
// Optional selective delay on fill requests
|
// Optional selective delay on fill requests
|
||||||
SELECTIVE_DELAY_MS: 0,
|
SELECTIVE_DELAY_MS: 0,
|
||||||
@ -146,7 +148,7 @@ describe.skip('CoordinatorWrapper', () => {
|
|||||||
};
|
};
|
||||||
coordinatorServerApp = await getAppAsync(
|
coordinatorServerApp = await getAppAsync(
|
||||||
{
|
{
|
||||||
[config.networkId]: provider,
|
[config.chainId]: provider,
|
||||||
},
|
},
|
||||||
coordinatorServerConfigs,
|
coordinatorServerConfigs,
|
||||||
{
|
{
|
||||||
@ -166,7 +168,7 @@ describe.skip('CoordinatorWrapper', () => {
|
|||||||
|
|
||||||
anotherCoordinatorServerApp = await getAppAsync(
|
anotherCoordinatorServerApp = await getAppAsync(
|
||||||
{
|
{
|
||||||
[config.networkId]: provider,
|
[config.chainId]: provider,
|
||||||
},
|
},
|
||||||
coordinatorServerConfigs,
|
coordinatorServerConfigs,
|
||||||
{
|
{
|
||||||
@ -454,7 +456,7 @@ describe.skip('CoordinatorWrapper', () => {
|
|||||||
nock(`${coordinatorEndpoint}${coordinatorPort}`)
|
nock(`${coordinatorEndpoint}${coordinatorPort}`)
|
||||||
.post('/v1/request_transaction', () => true)
|
.post('/v1/request_transaction', () => true)
|
||||||
.query({
|
.query({
|
||||||
networkId: 50,
|
chainId: 1337,
|
||||||
})
|
})
|
||||||
.reply(400, serverValidationError);
|
.reply(400, serverValidationError);
|
||||||
});
|
});
|
||||||
@ -503,7 +505,7 @@ describe.skip('CoordinatorWrapper', () => {
|
|||||||
nock(`${coordinatorEndpoint}${anotherCoordinatorPort}`)
|
nock(`${coordinatorEndpoint}${anotherCoordinatorPort}`)
|
||||||
.post('/v1/request_transaction', () => true)
|
.post('/v1/request_transaction', () => true)
|
||||||
.query({
|
.query({
|
||||||
networkId: 50,
|
chainId: 1337,
|
||||||
})
|
})
|
||||||
.reply(200, serverCancellationSuccess);
|
.reply(200, serverCancellationSuccess);
|
||||||
|
|
||||||
@ -531,7 +533,7 @@ describe.skip('CoordinatorWrapper', () => {
|
|||||||
nock(`${coordinatorEndpoint}${anotherCoordinatorPort}`)
|
nock(`${coordinatorEndpoint}${anotherCoordinatorPort}`)
|
||||||
.post('/v1/request_transaction', () => true)
|
.post('/v1/request_transaction', () => true)
|
||||||
.query({
|
.query({
|
||||||
networkId: 50,
|
chainId: 1337,
|
||||||
})
|
})
|
||||||
.reply(400, serverValidationError);
|
.reply(400, serverValidationError);
|
||||||
|
|
||||||
@ -610,7 +612,7 @@ describe.skip('CoordinatorWrapper', () => {
|
|||||||
nock(`${coordinatorEndpoint}${anotherCoordinatorPort}`)
|
nock(`${coordinatorEndpoint}${anotherCoordinatorPort}`)
|
||||||
.post('/v1/request_transaction', () => true)
|
.post('/v1/request_transaction', () => true)
|
||||||
.query({
|
.query({
|
||||||
networkId: 50,
|
chainId: 1337,
|
||||||
})
|
})
|
||||||
.reply(200, serverApprovalSuccess);
|
.reply(200, serverApprovalSuccess);
|
||||||
|
|
||||||
@ -639,7 +641,7 @@ describe.skip('CoordinatorWrapper', () => {
|
|||||||
nock(`${coordinatorEndpoint}${anotherCoordinatorPort}`)
|
nock(`${coordinatorEndpoint}${anotherCoordinatorPort}`)
|
||||||
.post('/v1/request_transaction', () => true)
|
.post('/v1/request_transaction', () => true)
|
||||||
.query({
|
.query({
|
||||||
networkId: 50,
|
chainId: 1337,
|
||||||
})
|
})
|
||||||
.reply(400, serverValidationError);
|
.reply(400, serverValidationError);
|
||||||
|
|
||||||
|
@ -2,9 +2,8 @@ import { BigNumber } from '@0x/utils';
|
|||||||
|
|
||||||
export const constants = {
|
export const constants = {
|
||||||
NULL_ADDRESS: '0x0000000000000000000000000000000000000000',
|
NULL_ADDRESS: '0x0000000000000000000000000000000000000000',
|
||||||
ROPSTEN_NETWORK_ID: 3,
|
ROPSTEN_CHAIN_ID: 3,
|
||||||
KOVAN_NETWORK_ID: 42,
|
KOVAN_CHAIN_ID: 42,
|
||||||
TESTRPC_NETWORK_ID: 50,
|
|
||||||
AWAIT_TRANSACTION_MINED_MS: 0,
|
AWAIT_TRANSACTION_MINED_MS: 0,
|
||||||
KOVAN_RPC_URL: 'https://kovan.infura.io/',
|
KOVAN_RPC_URL: 'https://kovan.infura.io/',
|
||||||
ROPSTEN_RPC_URL: 'https://ropsten.infura.io/',
|
ROPSTEN_RPC_URL: 'https://ropsten.infura.io/',
|
||||||
|
@ -1,4 +1,13 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"version": "3.0.0-beta.0",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "All references to network ID have been removed, and references to chain ID have been introduced instead",
|
||||||
|
"pr": 2313
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"version": "2.2.0-beta.0",
|
"version": "2.2.0-beta.0",
|
||||||
"changes": [
|
"changes": [
|
||||||
|
@ -546,11 +546,11 @@ export type OutputField =
|
|||||||
| 'ewasm.wast'
|
| 'ewasm.wast'
|
||||||
| 'ewasm.wasm';
|
| 'ewasm.wasm';
|
||||||
|
|
||||||
export interface ContractNetworks {
|
export interface ContractChains {
|
||||||
[networkId: number]: ContractNetworkData;
|
[chainId: number]: ContractChainData;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ContractNetworkData {
|
export interface ContractChainData {
|
||||||
address: string;
|
address: string;
|
||||||
links: {
|
links: {
|
||||||
[linkName: string]: string;
|
[linkName: string]: string;
|
||||||
@ -661,7 +661,7 @@ export interface CompilerOpts {
|
|||||||
* This type defines the schema of the artifact.json file generated by Sol-compiler
|
* This type defines the schema of the artifact.json file generated by Sol-compiler
|
||||||
* schemaVersion: The version of the artifact schema
|
* schemaVersion: The version of the artifact schema
|
||||||
* contractName: The contract name it represents
|
* contractName: The contract name it represents
|
||||||
* networks: Network specific information by network (address, id, constructor args, etc...)
|
* chains: Chain specific information by chain (address, id, constructor args, etc...)
|
||||||
* compilerOutput: The Solidity compiler output generated from the specified compiler input
|
* compilerOutput: The Solidity compiler output generated from the specified compiler input
|
||||||
* description (http://solidity.readthedocs.io/en/v0.4.24/using-the-compiler.html#compiler-input-and-output-json-description)
|
* description (http://solidity.readthedocs.io/en/v0.4.24/using-the-compiler.html#compiler-input-and-output-json-description)
|
||||||
* compiler: The compiler settings used
|
* compiler: The compiler settings used
|
||||||
@ -673,7 +673,7 @@ export interface CompilerOpts {
|
|||||||
export interface ContractArtifact extends ContractVersionData {
|
export interface ContractArtifact extends ContractVersionData {
|
||||||
schemaVersion: string;
|
schemaVersion: string;
|
||||||
contractName: string;
|
contractName: string;
|
||||||
networks: ContractNetworks;
|
chains: ContractChains;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GeneratedCompilerOptions {
|
export interface GeneratedCompilerOptions {
|
||||||
|
@ -1,4 +1,13 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"version": "5.0.0-beta.0",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "All references to network ID have been removed, and references to chain ID have been introduced instead",
|
||||||
|
"pr": 2313
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"version": "4.1.0-beta.0",
|
"version": "4.1.0-beta.0",
|
||||||
"changes": [
|
"changes": [
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
"properties": {
|
"properties": {
|
||||||
"makerAssetProxyId": { "$ref": "/hexSchema" },
|
"makerAssetProxyId": { "$ref": "/hexSchema" },
|
||||||
"takerAssetProxyId": { "$ref": "/hexSchema" },
|
"takerAssetProxyId": { "$ref": "/hexSchema" },
|
||||||
"networkId": { "type": "number" },
|
"chainId": { "type": "number" },
|
||||||
"makerAssetAddress": { "$ref": "/addressSchema" },
|
"makerAssetAddress": { "$ref": "/addressSchema" },
|
||||||
"takerAssetAddress": { "$ref": "/addressSchema" },
|
"takerAssetAddress": { "$ref": "/addressSchema" },
|
||||||
"makerAssetData": { "$ref": "/hexSchema" },
|
"makerAssetData": { "$ref": "/hexSchema" },
|
||||||
|
@ -2,6 +2,6 @@
|
|||||||
"id": "/RequestOptsSchema",
|
"id": "/RequestOptsSchema",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"networkId": { "type": "number" }
|
"chainId": { "type": "number" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,14 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"version": "4.4.0-beta.1",
|
"version": "5.0.0-beta.0",
|
||||||
"changes": [
|
"changes": [
|
||||||
{
|
{
|
||||||
"note": "Update all contract deployments to pass the actual chain ID (rather than the network ID) via the newly modified @0x/utils/provider_utils",
|
"note": "Update all contract deployments to pass the actual chain ID (rather than the network ID) via the newly modified @0x/utils/provider_utils",
|
||||||
"pr": 2270
|
"pr": 2270
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"note": "All references to network ID have been removed, and references to chain ID have been introduced instead",
|
||||||
|
"pr": 2313
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
import * as wrappers from '@0x/abi-gen-wrappers';
|
import * as wrappers from '@0x/abi-gen-wrappers';
|
||||||
import { getContractAddressesForNetworkOrThrow } from '@0x/contract-addresses';
|
import { getContractAddressesForChainOrThrow } from '@0x/contract-addresses';
|
||||||
import { ExchangeContract } from '@0x/contracts-exchange';
|
import { ExchangeContract } from '@0x/contracts-exchange';
|
||||||
import { ZeroExGovernorContract } from '@0x/contracts-multisig';
|
import { ZeroExGovernorContract } from '@0x/contracts-multisig';
|
||||||
import { StakingContract, StakingProxyContract, ZrxVaultContract } from '@0x/contracts-staking';
|
import { StakingContract, StakingProxyContract, ZrxVaultContract } from '@0x/contracts-staking';
|
||||||
@ -23,12 +23,12 @@ const networkIdToRpcUrl = {
|
|||||||
// tslint:disable:custom-no-magic-numbers
|
// tslint:disable:custom-no-magic-numbers
|
||||||
async function testContractConfigsAsync(provider: SupportedProvider): Promise<void> {
|
async function testContractConfigsAsync(provider: SupportedProvider): Promise<void> {
|
||||||
const web3Wrapper = new Web3Wrapper(provider);
|
const web3Wrapper = new Web3Wrapper(provider);
|
||||||
const networkId = await web3Wrapper.getNetworkIdAsync();
|
const chainId = await web3Wrapper.getChainIdAsync();
|
||||||
const addresses = getContractAddressesForNetworkOrThrow(networkId);
|
const addresses = getContractAddressesForChainOrThrow(chainId);
|
||||||
|
|
||||||
function warnIfMismatch(actual: any, expected: any, message: string): void {
|
function warnIfMismatch(actual: any, expected: any, message: string): void {
|
||||||
if (actual !== expected) {
|
if (actual !== expected) {
|
||||||
logUtils.warn(`${message}: actual: ${actual}, expected: ${expected}, networkId: ${networkId}`);
|
logUtils.warn(`${message}: actual: ${actual}, expected: ${expected}, chainId: ${chainId}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { getContractAddressesForNetworkOrThrow } from '@0x/contract-addresses';
|
import { getContractAddressesForChainOrThrow } from '@0x/contract-addresses';
|
||||||
import { artifacts as assetProxyArtifacts, ERC20BridgeProxyContract } from '@0x/contracts-asset-proxy';
|
import { artifacts as assetProxyArtifacts, ERC20BridgeProxyContract } from '@0x/contracts-asset-proxy';
|
||||||
import { artifacts as coordinatorArtifacts, CoordinatorContract } from '@0x/contracts-coordinator';
|
import { artifacts as coordinatorArtifacts, CoordinatorContract } from '@0x/contracts-coordinator';
|
||||||
import { artifacts as devUtilsArtifacts, DevUtilsContract } from '@0x/contracts-dev-utils';
|
import { artifacts as devUtilsArtifacts, DevUtilsContract } from '@0x/contracts-dev-utils';
|
||||||
@ -17,7 +17,6 @@ import {
|
|||||||
} from '@0x/contracts-staking';
|
} from '@0x/contracts-staking';
|
||||||
import { IAuthorizableContract, IOwnableContract } from '@0x/contracts-utils';
|
import { IAuthorizableContract, IOwnableContract } from '@0x/contracts-utils';
|
||||||
import { AbiEncoder, BigNumber, logUtils, providerUtils } from '@0x/utils';
|
import { AbiEncoder, BigNumber, logUtils, providerUtils } from '@0x/utils';
|
||||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
|
||||||
import { LogWithDecodedArgs, SupportedProvider, TxData } from 'ethereum-types';
|
import { LogWithDecodedArgs, SupportedProvider, TxData } from 'ethereum-types';
|
||||||
|
|
||||||
import { constants } from './utils/constants';
|
import { constants } from './utils/constants';
|
||||||
@ -47,10 +46,8 @@ async function submitAndExecuteTransactionAsync(
|
|||||||
*/
|
*/
|
||||||
export async function runMigrationsAsync(supportedProvider: SupportedProvider, txDefaults: TxData): Promise<void> {
|
export async function runMigrationsAsync(supportedProvider: SupportedProvider, txDefaults: TxData): Promise<void> {
|
||||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||||
const web3Wrapper = new Web3Wrapper(provider);
|
|
||||||
const networkId = await web3Wrapper.getNetworkIdAsync();
|
|
||||||
const chainId = new BigNumber(await providerUtils.getChainIdAsync(provider));
|
const chainId = new BigNumber(await providerUtils.getChainIdAsync(provider));
|
||||||
const deployedAddresses = getContractAddressesForNetworkOrThrow(networkId);
|
const deployedAddresses = getContractAddressesForChainOrThrow(chainId.toNumber());
|
||||||
|
|
||||||
// NOTE: This must be deployed before running these migrations, since its address is hard coded in the
|
// NOTE: This must be deployed before running these migrations, since its address is hard coded in the
|
||||||
// staking logic contract.
|
// staking logic contract.
|
||||||
|
@ -12,8 +12,8 @@ export const constants = {
|
|||||||
ERC721_PROXY_ID: '0x02571792',
|
ERC721_PROXY_ID: '0x02571792',
|
||||||
NULL_ADDRESS: '0x0000000000000000000000000000000000000000',
|
NULL_ADDRESS: '0x0000000000000000000000000000000000000000',
|
||||||
KOVAN_RPC_URL: 'https://kovan.infura.io/',
|
KOVAN_RPC_URL: 'https://kovan.infura.io/',
|
||||||
KOVAN_NETWORK_ID: 42,
|
KOVAN_CHAIN_ID: 42,
|
||||||
MAINNET_RPC_URL: 'https://mainnet.infura.io/',
|
MAINNET_RPC_URL: 'https://mainnet.infura.io/',
|
||||||
MAINNET_NETWORK_ID: 1,
|
MAINNET_CHAIN_ID: 1,
|
||||||
ZERO_AMOUNT: new BigNumber(0),
|
ZERO_AMOUNT: new BigNumber(0),
|
||||||
};
|
};
|
||||||
|
@ -2,7 +2,7 @@ import { BigNumber, NULL_BYTES } from '@0x/utils';
|
|||||||
|
|
||||||
import { ERC20Token, ERC721Token } from '../types';
|
import { ERC20Token, ERC721Token } from '../types';
|
||||||
|
|
||||||
export const etherTokenByNetwork: { [networkId: number]: { address: string } } = {
|
export const etherTokenByChain: { [chainId: number]: { address: string } } = {
|
||||||
3: {
|
3: {
|
||||||
address: '0xc778417e063141139fce010982780140aa0cd5ab',
|
address: '0xc778417e063141139fce010982780140aa0cd5ab',
|
||||||
},
|
},
|
||||||
@ -12,7 +12,7 @@ export const etherTokenByNetwork: { [networkId: number]: { address: string } } =
|
|||||||
42: {
|
42: {
|
||||||
address: '0xd0a1e359811322d97991e03f863a0c30c2cf029c',
|
address: '0xd0a1e359811322d97991e03f863a0c30c2cf029c',
|
||||||
},
|
},
|
||||||
50: {
|
1337: {
|
||||||
address: '',
|
address: '',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -1,10 +1,14 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"version": "8.5.0-beta.1",
|
"version": "9.0.0-beta.0",
|
||||||
"changes": [
|
"changes": [
|
||||||
{
|
{
|
||||||
"note": "Remove `TransferFailedError` from `ForwarderRevertErrors`.",
|
"note": "Remove `TransferFailedError` from `ForwarderRevertErrors`.",
|
||||||
"pr": 2309
|
"pr": 2309
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"note": "All references to network ID have been removed, and references to chain ID have been introduced instead",
|
||||||
|
"pr": 2313
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -89,7 +89,7 @@ export const constants = {
|
|||||||
NULL_ERC20_ASSET_DATA: '0xf47261b00000000000000000000000000000000000000000000000000000000000000000',
|
NULL_ERC20_ASSET_DATA: '0xf47261b00000000000000000000000000000000000000000000000000000000000000000',
|
||||||
// tslint:disable-next-line:custom-no-magic-numbers
|
// tslint:disable-next-line:custom-no-magic-numbers
|
||||||
UNLIMITED_ALLOWANCE_IN_BASE_UNITS: new BigNumber(2).pow(256).minus(1),
|
UNLIMITED_ALLOWANCE_IN_BASE_UNITS: new BigNumber(2).pow(256).minus(1),
|
||||||
TESTRPC_NETWORK_ID: 50,
|
TESTRPC_CHAIN_ID: 1337,
|
||||||
ADDRESS_LENGTH: 20,
|
ADDRESS_LENGTH: 20,
|
||||||
ERC20_ASSET_DATA_MIN_CHAR_LENGTH_WITH_PREFIX: 74, // 36 bytes
|
ERC20_ASSET_DATA_MIN_CHAR_LENGTH_WITH_PREFIX: 74, // 36 bytes
|
||||||
ERC721_ASSET_DATA_MIN_CHAR_LENGTH_WITH_PREFIX: 138, // 68 bytes
|
ERC721_ASSET_DATA_MIN_CHAR_LENGTH_WITH_PREFIX: 138, // 68 bytes
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { ExchangeContract, IValidatorContract, IWalletContract } from '@0x/abi-gen-wrappers';
|
import { ExchangeContract, IValidatorContract, IWalletContract } from '@0x/abi-gen-wrappers';
|
||||||
import { getContractAddressesForNetworkOrThrow } from '@0x/contract-addresses';
|
import { getContractAddressesForChainOrThrow } from '@0x/contract-addresses';
|
||||||
import { schemas } from '@0x/json-schemas';
|
import { schemas } from '@0x/json-schemas';
|
||||||
import {
|
import {
|
||||||
ECSignature,
|
ECSignature,
|
||||||
@ -120,8 +120,8 @@ export const signatureUtils = {
|
|||||||
exchangeContract = new ExchangeContract(exchangeAddress, provider);
|
exchangeContract = new ExchangeContract(exchangeAddress, provider);
|
||||||
} else {
|
} else {
|
||||||
const web3Wrapper = new Web3Wrapper(provider);
|
const web3Wrapper = new Web3Wrapper(provider);
|
||||||
const networkId = await web3Wrapper.getNetworkIdAsync();
|
const chainId = await web3Wrapper.getChainIdAsync();
|
||||||
const addresses = getContractAddressesForNetworkOrThrow(networkId);
|
const addresses = getContractAddressesForChainOrThrow(chainId);
|
||||||
exchangeContract = new ExchangeContract(addresses.exchange, provider);
|
exchangeContract = new ExchangeContract(addresses.exchange, provider);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -183,8 +183,8 @@ export const signatureUtils = {
|
|||||||
exchangeContract = new ExchangeContract(exchangeAddress, provider);
|
exchangeContract = new ExchangeContract(exchangeAddress, provider);
|
||||||
} else {
|
} else {
|
||||||
const web3Wrapper = new Web3Wrapper(provider);
|
const web3Wrapper = new Web3Wrapper(provider);
|
||||||
const networkId = await web3Wrapper.getNetworkIdAsync();
|
const chainId = await web3Wrapper.getChainIdAsync();
|
||||||
const addresses = getContractAddressesForNetworkOrThrow(networkId);
|
const addresses = getContractAddressesForChainOrThrow(chainId);
|
||||||
exchangeContract = new ExchangeContract(addresses.exchange, provider);
|
exchangeContract = new ExchangeContract(addresses.exchange, provider);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,13 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"version": "1.0.0-beta.0",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "All references to network ID have been removed, and references to chain ID have been introduced instead",
|
||||||
|
"pr": 2313
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"version": "0.1.0-beta.0",
|
"version": "0.1.0-beta.0",
|
||||||
"changes": [
|
"changes": [
|
||||||
|
@ -10,17 +10,17 @@ export const PER_PAGE_DEFAULT = 100;
|
|||||||
|
|
||||||
export abstract class BaseSRAOrderProvider extends BaseOrderProvider {
|
export abstract class BaseSRAOrderProvider extends BaseOrderProvider {
|
||||||
protected readonly _httpClient: HttpClient;
|
protected readonly _httpClient: HttpClient;
|
||||||
protected readonly _networkId?: number;
|
protected readonly _chainId?: number;
|
||||||
protected readonly _perPage: number;
|
protected readonly _perPage: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is an internal class for Websocket and Polling Order Providers
|
* This is an internal class for Websocket and Polling Order Providers
|
||||||
*/
|
*/
|
||||||
constructor(orderStore: OrderStore, httpEndpoint: string, perPage: number = PER_PAGE_DEFAULT, networkId?: number) {
|
constructor(orderStore: OrderStore, httpEndpoint: string, perPage: number = PER_PAGE_DEFAULT, chainId?: number) {
|
||||||
super(orderStore);
|
super(orderStore);
|
||||||
this._httpClient = new HttpClient(httpEndpoint);
|
this._httpClient = new HttpClient(httpEndpoint);
|
||||||
this._perPage = perPage;
|
this._perPage = perPage;
|
||||||
this._networkId = networkId;
|
this._chainId = chainId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -30,7 +30,7 @@ export abstract class BaseSRAOrderProvider extends BaseOrderProvider {
|
|||||||
public async getAvailableAssetDatasAsync(): Promise<AssetPairsItem[]> {
|
public async getAvailableAssetDatasAsync(): Promise<AssetPairsItem[]> {
|
||||||
const requestOpts = {
|
const requestOpts = {
|
||||||
perPage: this._perPage,
|
perPage: this._perPage,
|
||||||
networkId: this._networkId,
|
chainId: this._chainId,
|
||||||
};
|
};
|
||||||
let recordsToReturn: AssetPairsItem[] = [];
|
let recordsToReturn: AssetPairsItem[] = [];
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ export abstract class BaseSRAOrderProvider extends BaseOrderProvider {
|
|||||||
const rejected: RejectedOrder[] = [];
|
const rejected: RejectedOrder[] = [];
|
||||||
for (const order of orders) {
|
for (const order of orders) {
|
||||||
try {
|
try {
|
||||||
await this._httpClient.submitOrderAsync(order, { networkId: this._networkId });
|
await this._httpClient.submitOrderAsync(order, { chainId: this._chainId });
|
||||||
accepted.push(order);
|
accepted.push(order);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
rejected.push({ order, message: e.message });
|
rejected.push({ order, message: e.message });
|
||||||
@ -83,7 +83,7 @@ export abstract class BaseSRAOrderProvider extends BaseOrderProvider {
|
|||||||
makerAssetData,
|
makerAssetData,
|
||||||
takerAssetData,
|
takerAssetData,
|
||||||
perPage: this._perPage,
|
perPage: this._perPage,
|
||||||
networkId: this._networkId,
|
chainId: this._chainId,
|
||||||
};
|
};
|
||||||
|
|
||||||
let hasMorePages = true;
|
let hasMorePages = true;
|
||||||
|
@ -18,7 +18,7 @@ export class SRAPollingOrderProvider extends BaseSRAOrderProvider {
|
|||||||
* @param orderStore The `OrderStore` where orders are added and removed from
|
* @param orderStore The `OrderStore` where orders are added and removed from
|
||||||
*/
|
*/
|
||||||
constructor(opts: SRAPollingOrderProviderOpts, orderStore: OrderStore) {
|
constructor(opts: SRAPollingOrderProviderOpts, orderStore: OrderStore) {
|
||||||
super(orderStore, opts.httpEndpoint, opts.perPage, opts.networkId);
|
super(orderStore, opts.httpEndpoint, opts.perPage, opts.chainId);
|
||||||
assert.isNumber('pollingIntervalMs', opts.pollingIntervalMs);
|
assert.isNumber('pollingIntervalMs', opts.pollingIntervalMs);
|
||||||
this._pollingIntervalMs = opts.pollingIntervalMs;
|
this._pollingIntervalMs = opts.pollingIntervalMs;
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ export class SRAWebsocketOrderProvider extends BaseSRAOrderProvider {
|
|||||||
* @param orderStore The `OrderStore` where orders are added and removed from
|
* @param orderStore The `OrderStore` where orders are added and removed from
|
||||||
*/
|
*/
|
||||||
constructor(opts: SRAWebsocketOrderProviderOpts, orderStore: OrderStore) {
|
constructor(opts: SRAWebsocketOrderProviderOpts, orderStore: OrderStore) {
|
||||||
super(orderStore, opts.httpEndpoint, PER_PAGE_DEFAULT, opts.networkId);
|
super(orderStore, opts.httpEndpoint, PER_PAGE_DEFAULT, opts.chainId);
|
||||||
assert.isUri('websocketEndpoint', opts.websocketEndpoint);
|
assert.isUri('websocketEndpoint', opts.websocketEndpoint);
|
||||||
this._websocketEndpoint = opts.websocketEndpoint;
|
this._websocketEndpoint = opts.websocketEndpoint;
|
||||||
}
|
}
|
||||||
|
@ -26,8 +26,8 @@ export interface SRAWebsocketOrderProviderOpts {
|
|||||||
httpEndpoint: string;
|
httpEndpoint: string;
|
||||||
// The websocket endpoint to the SRA service, e.g wss://ws.sra.0x.org/
|
// The websocket endpoint to the SRA service, e.g wss://ws.sra.0x.org/
|
||||||
websocketEndpoint: string;
|
websocketEndpoint: string;
|
||||||
// The network Id
|
// The chain Id
|
||||||
networkId?: number;
|
chainId?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -40,8 +40,8 @@ export interface SRAPollingOrderProviderOpts {
|
|||||||
pollingIntervalMs: number;
|
pollingIntervalMs: number;
|
||||||
// The amount of records to request per request to the SRA endpoint
|
// The amount of records to request per request to the SRA endpoint
|
||||||
perPage?: number;
|
perPage?: number;
|
||||||
// The network Id
|
// The chain Id
|
||||||
networkId?: number;
|
chainId?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,4 +1,13 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"version": "4.0.0-beta.0",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Output artifacts now include a 'chains' attribute rather than 'networks'",
|
||||||
|
"pr": 2313
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"version": "3.2.0-beta.0",
|
"version": "3.2.0-beta.0",
|
||||||
"changes": [
|
"changes": [
|
||||||
|
@ -405,7 +405,7 @@ export class Compiler {
|
|||||||
schemaVersion: constants.LATEST_ARTIFACT_VERSION,
|
schemaVersion: constants.LATEST_ARTIFACT_VERSION,
|
||||||
contractName,
|
contractName,
|
||||||
...contractVersion,
|
...contractVersion,
|
||||||
networks: {},
|
chains: {},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,10 +14,10 @@ import { fsWrapper } from './fs_wrapper';
|
|||||||
import { BinaryPaths, CompilationError } from './types';
|
import { BinaryPaths, CompilationError } from './types';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets contract data on network or returns if an artifact does not exist.
|
* Gets contract data or returns if an artifact does not exist.
|
||||||
* @param artifactsDir Path to the artifacts directory.
|
* @param artifactsDir Path to the artifacts directory.
|
||||||
* @param contractName Name of contract.
|
* @param contractName Name of contract.
|
||||||
* @return Contract data on network or undefined.
|
* @return Contract data or undefined.
|
||||||
*/
|
*/
|
||||||
export async function getContractArtifactIfExistsAsync(
|
export async function getContractArtifactIfExistsAsync(
|
||||||
artifactsDir: string,
|
artifactsDir: string,
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import { BigNumber } from '@0x/utils';
|
import { BigNumber } from '@0x/utils';
|
||||||
|
|
||||||
export const constants = {
|
export const constants = {
|
||||||
networkId: 0,
|
|
||||||
optimizerEnabled: false,
|
optimizerEnabled: false,
|
||||||
gasPrice: new BigNumber(20000000000),
|
gasPrice: new BigNumber(20000000000),
|
||||||
timeoutMs: 30000,
|
timeoutMs: 30000,
|
||||||
|
@ -1,4 +1,13 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"version": "3.0.0-beta.0",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "All references to network ID have been removed, and references to chain ID have been introduced instead",
|
||||||
|
"pr": 2313
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"version": "2.1.0-beta.0",
|
"version": "2.1.0-beta.0",
|
||||||
"changes": [
|
"changes": [
|
||||||
|
@ -3,9 +3,9 @@ export const validationError = {
|
|||||||
reason: 'Validation failed',
|
reason: 'Validation failed',
|
||||||
validationErrors: [
|
validationErrors: [
|
||||||
{
|
{
|
||||||
field: 'networkId',
|
field: 'chainId',
|
||||||
code: 1006,
|
code: 1006,
|
||||||
reason: 'Network id 42 is not supported',
|
reason: 'Chain id 42 is not supported',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
@ -34,26 +34,26 @@ All endpoints that are paginated should return a `total`, `page`, `perPage` and
|
|||||||
|
|
||||||
These requests include the [`/v3/asset_pairs`](#operation/getAssetPairs), [`/v3/orders`](#operation/getOrders), [`/v3/fee_recipients`](#operation/getFeeRecipients) and [`/v3/orderbook`](#operation/getOrderbook) endpoints.
|
These requests include the [`/v3/asset_pairs`](#operation/getAssetPairs), [`/v3/orders`](#operation/getOrders), [`/v3/fee_recipients`](#operation/getFeeRecipients) and [`/v3/orderbook`](#operation/getOrderbook) endpoints.
|
||||||
|
|
||||||
# Network Id
|
# Chain Id
|
||||||
|
|
||||||
All requests should be able to specify a **?networkId** query param for all supported networks. For example:
|
All requests should be able to specify a **?chainId** query param for all supported chains. For example:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ curl https://api.example-relayer.com/v3/asset_pairs?networkId=1
|
$ curl https://api.example-relayer.com/v3/asset_pairs?chainId=1
|
||||||
```
|
```
|
||||||
|
|
||||||
If the query param is not provided, it should default to **1** (mainnet).
|
If the query param is not provided, it should default to **1** (mainnet).
|
||||||
|
|
||||||
Networks and their Ids:
|
Chains and their Ids:
|
||||||
|
|
||||||
| Network Id | Network Name |
|
| Chain Id | Chain Name |
|
||||||
| ---------- | ------------ |
|
| -------- | ---------- |
|
||||||
| 1 | Mainnet |
|
| 1 | Mainnet |
|
||||||
| 42 | Kovan |
|
| 42 | Kovan |
|
||||||
| 3 | Ropsten |
|
| 3 | Ropsten |
|
||||||
| 4 | Rinkeby |
|
| 4 | Rinkeby |
|
||||||
|
|
||||||
If a certain network is not supported, the response should **400** as specified in the [error response](#section/Errors) section. For example:
|
If a certain chain is not supported, the response should **400** as specified in the [error response](#section/Errors) section. For example:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
@ -61,9 +61,9 @@ If a certain network is not supported, the response should **400** as specified
|
|||||||
"reason": "Validation failed",
|
"reason": "Validation failed",
|
||||||
"validationErrors": [
|
"validationErrors": [
|
||||||
{
|
{
|
||||||
"field": "networkId",
|
"field": "chainId",
|
||||||
"code": 1006,
|
"code": 1006,
|
||||||
"reason": "Network id 42 is not supported"
|
"reason": "Chain id 42 is not supported"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -22,10 +22,10 @@ export const paginationParameters: ParameterObject[] = [
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
export const networkdIdParameter: ParameterObject = {
|
export const chainIdParameter: ParameterObject = {
|
||||||
name: 'networkId',
|
name: 'chainId',
|
||||||
in: 'query',
|
in: 'query',
|
||||||
description: 'The id of the Ethereum network',
|
description: 'The id of the Ethereum chain',
|
||||||
example: 42,
|
example: 42,
|
||||||
schema: {
|
schema: {
|
||||||
type: 'number',
|
type: 'number',
|
||||||
@ -35,5 +35,5 @@ export const networkdIdParameter: ParameterObject = {
|
|||||||
|
|
||||||
export const generateParameters = (parameters: ParameterObject[], isPaginated: boolean = false): ParameterObject[] => {
|
export const generateParameters = (parameters: ParameterObject[], isPaginated: boolean = false): ParameterObject[] => {
|
||||||
const optionalParameters = isPaginated ? paginationParameters : [];
|
const optionalParameters = isPaginated ? paginationParameters : [];
|
||||||
return [...parameters, networkdIdParameter, ...optionalParameters];
|
return [...parameters, chainIdParameter, ...optionalParameters];
|
||||||
};
|
};
|
||||||
|
@ -4,7 +4,7 @@ import { Web3Wrapper } from '@0x/web3-wrapper';
|
|||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
import { configs } from './configs';
|
import { configs } from './configs';
|
||||||
import { TOKENS_BY_NETWORK } from './tokens';
|
import { TOKENS_BY_CHAIN } from './tokens';
|
||||||
|
|
||||||
const DISPENSE_AMOUNT_ETHER = 0.1;
|
const DISPENSE_AMOUNT_ETHER = 0.1;
|
||||||
const DISPENSE_AMOUNT_TOKEN = 1;
|
const DISPENSE_AMOUNT_TOKEN = 1;
|
||||||
@ -36,13 +36,13 @@ export const dispenseAssetTasks = {
|
|||||||
dispenseTokenTask(
|
dispenseTokenTask(
|
||||||
recipientAddress: string,
|
recipientAddress: string,
|
||||||
tokenSymbol: string,
|
tokenSymbol: string,
|
||||||
networkId: number,
|
chainId: number,
|
||||||
provider: SupportedProvider,
|
provider: SupportedProvider,
|
||||||
): AsyncTask {
|
): AsyncTask {
|
||||||
return async () => {
|
return async () => {
|
||||||
logUtils.log(`Processing ${tokenSymbol} ${recipientAddress}`);
|
logUtils.log(`Processing ${tokenSymbol} ${recipientAddress}`);
|
||||||
const amountToDispense = new BigNumber(DISPENSE_AMOUNT_TOKEN);
|
const amountToDispense = new BigNumber(DISPENSE_AMOUNT_TOKEN);
|
||||||
const tokenIfExists = _.get(TOKENS_BY_NETWORK, [networkId, tokenSymbol]);
|
const tokenIfExists = _.get(TOKENS_BY_CHAIN, [chainId, tokenSymbol]);
|
||||||
if (tokenIfExists === undefined) {
|
if (tokenIfExists === undefined) {
|
||||||
throw new Error(`Unsupported asset type: ${tokenSymbol}`);
|
throw new Error(`Unsupported asset type: ${tokenSymbol}`);
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ import {
|
|||||||
SignedOrder,
|
SignedOrder,
|
||||||
Web3ProviderEngine,
|
Web3ProviderEngine,
|
||||||
} from '0x.js';
|
} from '0x.js';
|
||||||
import { getContractAddressesForNetworkOrThrow } from '@0x/contract-addresses';
|
import { getContractAddressesForChainOrThrow } from '@0x/contract-addresses';
|
||||||
import { NonceTrackerSubprovider, PrivateKeyWalletSubprovider } from '@0x/subproviders';
|
import { NonceTrackerSubprovider, PrivateKeyWalletSubprovider } from '@0x/subproviders';
|
||||||
import { logUtils } from '@0x/utils';
|
import { logUtils } from '@0x/utils';
|
||||||
import { SupportedProvider, Web3Wrapper } from '@0x/web3-wrapper';
|
import { SupportedProvider, Web3Wrapper } from '@0x/web3-wrapper';
|
||||||
@ -21,17 +21,17 @@ import { constants } from './constants';
|
|||||||
import { DispatchQueue } from './dispatch_queue';
|
import { DispatchQueue } from './dispatch_queue';
|
||||||
import { dispenseAssetTasks } from './dispense_asset_tasks';
|
import { dispenseAssetTasks } from './dispense_asset_tasks';
|
||||||
import { rpcUrls } from './rpc_urls';
|
import { rpcUrls } from './rpc_urls';
|
||||||
import { TOKENS_BY_NETWORK } from './tokens';
|
import { TOKENS_BY_CHAIN } from './tokens';
|
||||||
|
|
||||||
interface NetworkConfig {
|
interface ChainConfig {
|
||||||
dispatchQueue: DispatchQueue;
|
dispatchQueue: DispatchQueue;
|
||||||
web3Wrapper: Web3Wrapper;
|
web3Wrapper: Web3Wrapper;
|
||||||
provider: SupportedProvider;
|
provider: SupportedProvider;
|
||||||
networkId: number;
|
chainId: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ItemByNetworkId<T> {
|
interface ItemByChainId<T> {
|
||||||
[networkId: string]: T;
|
[chainId: string]: T;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum RequestedAssetType {
|
enum RequestedAssetType {
|
||||||
@ -46,7 +46,7 @@ const ZERO = new BigNumber(0);
|
|||||||
const ASSET_AMOUNT = new BigNumber(0.1);
|
const ASSET_AMOUNT = new BigNumber(0.1);
|
||||||
|
|
||||||
export class Handler {
|
export class Handler {
|
||||||
private readonly _networkConfigByNetworkId: ItemByNetworkId<NetworkConfig> = {};
|
private readonly _chainConfigByChainId: ItemByChainId<ChainConfig> = {};
|
||||||
private static _createProviderEngine(rpcUrl: string): Web3ProviderEngine {
|
private static _createProviderEngine(rpcUrl: string): Web3ProviderEngine {
|
||||||
if (configs.DISPENSER_PRIVATE_KEY === undefined) {
|
if (configs.DISPENSER_PRIVATE_KEY === undefined) {
|
||||||
throw new Error('Dispenser Private key not found');
|
throw new Error('Dispenser Private key not found');
|
||||||
@ -59,24 +59,24 @@ export class Handler {
|
|||||||
return engine;
|
return engine;
|
||||||
}
|
}
|
||||||
constructor() {
|
constructor() {
|
||||||
_.forIn(rpcUrls, (rpcUrl: string, networkIdString: string) => {
|
_.forIn(rpcUrls, (rpcUrl: string, chainIdString: string) => {
|
||||||
const providerObj = Handler._createProviderEngine(rpcUrl);
|
const providerObj = Handler._createProviderEngine(rpcUrl);
|
||||||
const web3Wrapper = new Web3Wrapper(providerObj);
|
const web3Wrapper = new Web3Wrapper(providerObj);
|
||||||
// tslint:disable-next-line:custom-no-magic-numbers
|
// tslint:disable-next-line:custom-no-magic-numbers
|
||||||
const networkId = parseInt(networkIdString, 10);
|
const chainId = parseInt(chainIdString, 10);
|
||||||
const dispatchQueue = new DispatchQueue();
|
const dispatchQueue = new DispatchQueue();
|
||||||
this._networkConfigByNetworkId[networkId] = {
|
this._chainConfigByChainId[chainId] = {
|
||||||
dispatchQueue,
|
dispatchQueue,
|
||||||
web3Wrapper,
|
web3Wrapper,
|
||||||
provider: providerObj,
|
provider: providerObj,
|
||||||
networkId,
|
chainId,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
public getQueueInfo(_req: express.Request, res: express.Response): void {
|
public getQueueInfo(_req: express.Request, res: express.Response): void {
|
||||||
res.setHeader('Content-Type', 'application/json');
|
res.setHeader('Content-Type', 'application/json');
|
||||||
const queueInfo = _.mapValues(rpcUrls, (_rpcUrl: string, networkId: string) => {
|
const queueInfo = _.mapValues(rpcUrls, (_rpcUrl: string, chainId: string) => {
|
||||||
const dispatchQueue = this._networkConfigByNetworkId[networkId].dispatchQueue;
|
const dispatchQueue = this._chainConfigByChainId[chainId].dispatchQueue;
|
||||||
return {
|
return {
|
||||||
full: dispatchQueue.isFull(),
|
full: dispatchQueue.isFull(),
|
||||||
size: dispatchQueue.size(),
|
size: dispatchQueue.size(),
|
||||||
@ -102,36 +102,36 @@ export class Handler {
|
|||||||
await this._dispenseOrderAsync(req, res, RequestedAssetType.ZRX);
|
await this._dispenseOrderAsync(req, res, RequestedAssetType.ZRX);
|
||||||
}
|
}
|
||||||
private _dispenseAsset(req: express.Request, res: express.Response, requestedAssetType: RequestedAssetType): void {
|
private _dispenseAsset(req: express.Request, res: express.Response, requestedAssetType: RequestedAssetType): void {
|
||||||
const networkId = req.params.networkId;
|
const chainId = req.params.chainId;
|
||||||
const recipient = req.params.recipient;
|
const recipient = req.params.recipient;
|
||||||
const networkConfig = _.get(this._networkConfigByNetworkId, networkId);
|
const chainConfig = _.get(this._chainConfigByChainId, chainId);
|
||||||
if (networkConfig === undefined) {
|
if (chainConfig === undefined) {
|
||||||
res.status(constants.BAD_REQUEST_STATUS).send('UNSUPPORTED_NETWORK_ID');
|
res.status(constants.BAD_REQUEST_STATUS).send('UNSUPPORTED_CHAIN_ID');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let dispenserTask;
|
let dispenserTask;
|
||||||
switch (requestedAssetType) {
|
switch (requestedAssetType) {
|
||||||
case RequestedAssetType.ETH:
|
case RequestedAssetType.ETH:
|
||||||
dispenserTask = dispenseAssetTasks.dispenseEtherTask(recipient, networkConfig.web3Wrapper);
|
dispenserTask = dispenseAssetTasks.dispenseEtherTask(recipient, chainConfig.web3Wrapper);
|
||||||
break;
|
break;
|
||||||
case RequestedAssetType.WETH:
|
case RequestedAssetType.WETH:
|
||||||
case RequestedAssetType.ZRX:
|
case RequestedAssetType.ZRX:
|
||||||
dispenserTask = dispenseAssetTasks.dispenseTokenTask(
|
dispenserTask = dispenseAssetTasks.dispenseTokenTask(
|
||||||
recipient,
|
recipient,
|
||||||
requestedAssetType,
|
requestedAssetType,
|
||||||
networkConfig.networkId,
|
chainConfig.chainId,
|
||||||
networkConfig.provider,
|
chainConfig.provider,
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new Error(`Unsupported asset type: ${requestedAssetType}`);
|
throw new Error(`Unsupported asset type: ${requestedAssetType}`);
|
||||||
}
|
}
|
||||||
const didAddToQueue = networkConfig.dispatchQueue.add(dispenserTask);
|
const didAddToQueue = chainConfig.dispatchQueue.add(dispenserTask);
|
||||||
if (!didAddToQueue) {
|
if (!didAddToQueue) {
|
||||||
res.status(constants.SERVICE_UNAVAILABLE_STATUS).send('QUEUE_IS_FULL');
|
res.status(constants.SERVICE_UNAVAILABLE_STATUS).send('QUEUE_IS_FULL');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
logUtils.log(`Added ${recipient} to queue: ${requestedAssetType} networkId: ${networkId}`);
|
logUtils.log(`Added ${recipient} to queue: ${requestedAssetType} chainId: ${chainId}`);
|
||||||
res.status(constants.SUCCESS_STATUS).end();
|
res.status(constants.SUCCESS_STATUS).end();
|
||||||
}
|
}
|
||||||
private async _dispenseOrderAsync(
|
private async _dispenseOrderAsync(
|
||||||
@ -139,19 +139,19 @@ export class Handler {
|
|||||||
res: express.Response,
|
res: express.Response,
|
||||||
requestedAssetType: RequestedAssetType,
|
requestedAssetType: RequestedAssetType,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const networkConfig = _.get(this._networkConfigByNetworkId, req.params.networkId);
|
const chainConfig = _.get(this._chainConfigByChainId, req.params.chainId);
|
||||||
if (networkConfig === undefined) {
|
if (chainConfig === undefined) {
|
||||||
res.status(constants.BAD_REQUEST_STATUS).send('UNSUPPORTED_NETWORK_ID');
|
res.status(constants.BAD_REQUEST_STATUS).send('UNSUPPORTED_CHAIN_ID');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
res.setHeader('Content-Type', 'application/json');
|
res.setHeader('Content-Type', 'application/json');
|
||||||
const makerTokenIfExists = _.get(TOKENS_BY_NETWORK, [networkConfig.networkId, requestedAssetType]);
|
const makerTokenIfExists = _.get(TOKENS_BY_CHAIN, [chainConfig.chainId, requestedAssetType]);
|
||||||
if (makerTokenIfExists === undefined) {
|
if (makerTokenIfExists === undefined) {
|
||||||
throw new Error(`Unsupported asset type: ${requestedAssetType}`);
|
throw new Error(`Unsupported asset type: ${requestedAssetType}`);
|
||||||
}
|
}
|
||||||
const takerTokenSymbol =
|
const takerTokenSymbol =
|
||||||
requestedAssetType === RequestedAssetType.WETH ? RequestedAssetType.ZRX : RequestedAssetType.WETH;
|
requestedAssetType === RequestedAssetType.WETH ? RequestedAssetType.ZRX : RequestedAssetType.WETH;
|
||||||
const takerTokenIfExists = _.get(TOKENS_BY_NETWORK, [networkConfig.networkId, takerTokenSymbol]);
|
const takerTokenIfExists = _.get(TOKENS_BY_CHAIN, [chainConfig.chainId, takerTokenSymbol]);
|
||||||
if (takerTokenIfExists === undefined) {
|
if (takerTokenIfExists === undefined) {
|
||||||
throw new Error(`Unsupported asset type: ${takerTokenSymbol}`);
|
throw new Error(`Unsupported asset type: ${takerTokenSymbol}`);
|
||||||
}
|
}
|
||||||
@ -160,7 +160,7 @@ export class Handler {
|
|||||||
const takerAssetAmount = Web3Wrapper.toBaseUnitAmount(ASSET_AMOUNT, takerTokenIfExists.decimals);
|
const takerAssetAmount = Web3Wrapper.toBaseUnitAmount(ASSET_AMOUNT, takerTokenIfExists.decimals);
|
||||||
const makerAssetData = assetDataUtils.encodeERC20AssetData(makerTokenIfExists.address);
|
const makerAssetData = assetDataUtils.encodeERC20AssetData(makerTokenIfExists.address);
|
||||||
const takerAssetData = assetDataUtils.encodeERC20AssetData(takerTokenIfExists.address);
|
const takerAssetData = assetDataUtils.encodeERC20AssetData(takerTokenIfExists.address);
|
||||||
const contractAddresses = getContractAddressesForNetworkOrThrow(networkConfig.networkId);
|
const contractAddresses = getContractAddressesForChainOrThrow(chainConfig.chainId);
|
||||||
const order: Order = {
|
const order: Order = {
|
||||||
makerAddress: configs.DISPENSER_ADDRESS,
|
makerAddress: configs.DISPENSER_ADDRESS,
|
||||||
takerAddress: req.params.recipient as string,
|
takerAddress: req.params.recipient as string,
|
||||||
@ -180,11 +180,11 @@ export class Handler {
|
|||||||
.div(1000)
|
.div(1000)
|
||||||
.integerValue(BigNumber.ROUND_FLOOR),
|
.integerValue(BigNumber.ROUND_FLOOR),
|
||||||
exchangeAddress: contractAddresses.exchange,
|
exchangeAddress: contractAddresses.exchange,
|
||||||
chainId: networkConfig.networkId,
|
chainId: chainConfig.chainId,
|
||||||
};
|
};
|
||||||
const orderHash = orderHashUtils.getOrderHashHex(order);
|
const orderHash = orderHashUtils.getOrderHashHex(order);
|
||||||
const signature = await signatureUtils.ecSignHashAsync(
|
const signature = await signatureUtils.ecSignHashAsync(
|
||||||
networkConfig.web3Wrapper.getProvider(),
|
chainConfig.web3Wrapper.getProvider(),
|
||||||
orderHash,
|
orderHash,
|
||||||
configs.DISPENSER_ADDRESS,
|
configs.DISPENSER_ADDRESS,
|
||||||
);
|
);
|
||||||
|
@ -5,7 +5,7 @@ import * as _ from 'lodash';
|
|||||||
import { constants } from './constants';
|
import { constants } from './constants';
|
||||||
import { rpcUrls } from './rpc_urls';
|
import { rpcUrls } from './rpc_urls';
|
||||||
|
|
||||||
const DEFAULT_NETWORK_ID = 42; // kovan
|
const DEFAULT_CHAIN_ID = 42; // kovan
|
||||||
|
|
||||||
export const parameterTransformer = {
|
export const parameterTransformer = {
|
||||||
transform(req: Request, res: Response, next: NextFunction): void {
|
transform(req: Request, res: Response, next: NextFunction): void {
|
||||||
@ -16,13 +16,13 @@ export const parameterTransformer = {
|
|||||||
}
|
}
|
||||||
const lowerCaseRecipientAddress = recipientAddress.toLowerCase();
|
const lowerCaseRecipientAddress = recipientAddress.toLowerCase();
|
||||||
req.params.recipient = lowerCaseRecipientAddress;
|
req.params.recipient = lowerCaseRecipientAddress;
|
||||||
const networkId = _.get(req.query, 'networkId', DEFAULT_NETWORK_ID);
|
const chainId = _.get(req.query, 'chainId', DEFAULT_CHAIN_ID);
|
||||||
const rpcUrlIfExists = _.get(rpcUrls, networkId);
|
const rpcUrlIfExists = _.get(rpcUrls, chainId);
|
||||||
if (rpcUrlIfExists === undefined) {
|
if (rpcUrlIfExists === undefined) {
|
||||||
res.status(constants.BAD_REQUEST_STATUS).send('UNSUPPORTED_NETWORK_ID');
|
res.status(constants.BAD_REQUEST_STATUS).send('UNSUPPORTED_CHAIN_ID');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
req.params.networkId = networkId;
|
req.params.chainId = chainId;
|
||||||
next();
|
next();
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
interface TokensByNetwork {
|
interface TokensByChain {
|
||||||
[networkId: number]: { [tokenSymbol: string]: { address: string; decimals: number } };
|
[chainId: number]: { [tokenSymbol: string]: { address: string; decimals: number } };
|
||||||
}
|
}
|
||||||
|
|
||||||
export const tokens = {
|
export const tokens = {
|
||||||
@ -10,7 +10,7 @@ export const tokens = {
|
|||||||
decimals: 18,
|
decimals: 18,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
export const TOKENS_BY_NETWORK: TokensByNetwork = {
|
export const TOKENS_BY_CHAIN: TokensByChain = {
|
||||||
3: {
|
3: {
|
||||||
ZRX: {
|
ZRX: {
|
||||||
...tokens.ZRX,
|
...tokens.ZRX,
|
||||||
|
@ -1,10 +1,14 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"version": "2.5.0-beta.1",
|
"version": "3.0.0-beta.0",
|
||||||
"changes": [
|
"changes": [
|
||||||
{
|
{
|
||||||
"note": "Add `SendTransactionOpts` and `AwaitTransactionSuccessOpts` types for contract wrappers",
|
"note": "Add `SendTransactionOpts` and `AwaitTransactionSuccessOpts` types for contract wrappers",
|
||||||
"pr": 2243
|
"pr": 2243
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"note": "All references to network ID have been removed, and references to chain ID have been introduced instead",
|
||||||
|
"pr": 2313
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
import { BigNumber } from 'bignumber.js';
|
import { BigNumber } from 'bignumber.js';
|
||||||
import {
|
import {
|
||||||
ContractAbi,
|
ContractAbi,
|
||||||
|
ContractChains,
|
||||||
ContractEventArg,
|
ContractEventArg,
|
||||||
ContractNetworks,
|
|
||||||
DecodedLogArgs,
|
DecodedLogArgs,
|
||||||
DevdocOutput,
|
DevdocOutput,
|
||||||
LogWithDecodedArgs,
|
LogWithDecodedArgs,
|
||||||
@ -103,8 +103,8 @@ export type ArtifactContractName = 'ZRX' | 'TokenTransferProxy' | 'TokenRegistry
|
|||||||
export interface Artifact {
|
export interface Artifact {
|
||||||
contract_name: ArtifactContractName;
|
contract_name: ArtifactContractName;
|
||||||
abi: ContractAbi;
|
abi: ContractAbi;
|
||||||
networks: {
|
chains: {
|
||||||
[networkId: number]: {
|
[chainId: number]: {
|
||||||
address: string;
|
address: string;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -484,7 +484,7 @@ export interface OrderConfigResponse {
|
|||||||
export type FeeRecipientsResponse = PaginatedCollection<string>;
|
export type FeeRecipientsResponse = PaginatedCollection<string>;
|
||||||
|
|
||||||
export interface RequestOpts {
|
export interface RequestOpts {
|
||||||
networkId?: number;
|
chainId?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PagedRequestOpts {
|
export interface PagedRequestOpts {
|
||||||
@ -882,7 +882,7 @@ export interface SimpleContractArtifact {
|
|||||||
schemaVersion: string;
|
schemaVersion: string;
|
||||||
contractName: string;
|
contractName: string;
|
||||||
compilerOutput: SimpleStandardContractOutput;
|
compilerOutput: SimpleStandardContractOutput;
|
||||||
networks: ContractNetworks;
|
chains: ContractChains;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SimpleStandardContractOutput {
|
export interface SimpleStandardContractOutput {
|
||||||
|
@ -99,7 +99,7 @@ export const providerUtils = {
|
|||||||
/**
|
/**
|
||||||
* Retrieve the chain ID from a supported provider.
|
* Retrieve the chain ID from a supported provider.
|
||||||
* @param supportedProvider A supported provider instance.
|
* @param supportedProvider A supported provider instance.
|
||||||
* @return A promise thar resolves to the chain ID of the network the provider
|
* @return A promise that resolves to the chain ID of the network the provider
|
||||||
* is connected to.
|
* is connected to.
|
||||||
*/
|
*/
|
||||||
async getChainIdAsync(supportedProvider: SupportedProvider): Promise<number> {
|
async getChainIdAsync(supportedProvider: SupportedProvider): Promise<number> {
|
||||||
|
@ -4,7 +4,7 @@ export interface FunctionInfo {
|
|||||||
functionSignature: string;
|
functionSignature: string;
|
||||||
contractName?: string;
|
contractName?: string;
|
||||||
contractAddress?: string;
|
contractAddress?: string;
|
||||||
networkId?: number;
|
chainId?: number;
|
||||||
abiEncoder?: AbiEncoder.Method;
|
abiEncoder?: AbiEncoder.Method;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 3.0.0 - TBD
|
||||||
|
|
||||||
|
- Addresses are now indexed by chain ID rather than by network ID.
|
||||||
|
|
||||||
## 2.2.0 - 2019-08-08
|
## 2.2.0 - 2019-08-08
|
||||||
|
|
||||||
- Added ERC1155Proxy address
|
- Added ERC1155Proxy address
|
||||||
|
@ -10,7 +10,7 @@ Python zero_ex.contract_addresses
|
|||||||
.. automodule:: zero_ex.contract_addresses
|
.. automodule:: zero_ex.contract_addresses
|
||||||
:no-members:
|
:no-members:
|
||||||
|
|
||||||
.. autoclass:: zero_ex.contract_addresses.NetworkId
|
.. autoclass:: zero_ex.contract_addresses.ChainId
|
||||||
:members:
|
:members:
|
||||||
:undoc-members:
|
:undoc-members:
|
||||||
:show-inheritance:
|
:show-inheritance:
|
||||||
@ -19,8 +19,8 @@ Python zero_ex.contract_addresses
|
|||||||
:members:
|
:members:
|
||||||
:show-inheritance:
|
:show-inheritance:
|
||||||
|
|
||||||
.. autodata:: zero_ex.contract_addresses.network_to_addresses
|
.. autodata:: zero_ex.contract_addresses.chain_to_addresses
|
||||||
:annotation: : Dict[NetworkId, ContractAddresses]
|
:annotation: : Dict[ChainId, ContractAddresses]
|
||||||
|
|
||||||
Indices and tables
|
Indices and tables
|
||||||
==================
|
==================
|
||||||
|
@ -83,13 +83,13 @@ class ContractAddresses(NamedTuple):
|
|||||||
"""Address of the ERC20BridgeProxy contract."""
|
"""Address of the ERC20BridgeProxy contract."""
|
||||||
|
|
||||||
|
|
||||||
class NetworkId(Enum):
|
class ChainId(Enum):
|
||||||
"""Network names correlated to their network identification numbers.
|
"""Chain names correlated to their chain identification numbers.
|
||||||
|
|
||||||
>>> NetworkId.MAINNET
|
>>> ChainId.MAINNET
|
||||||
<NetworkId.MAINNET: 1>
|
<ChainId.MAINNET: 1>
|
||||||
|
|
||||||
>>> NetworkId.MAINNET.value
|
>>> ChainId.MAINNET.value
|
||||||
1
|
1
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@ -97,7 +97,7 @@ class NetworkId(Enum):
|
|||||||
ROPSTEN = 3
|
ROPSTEN = 3
|
||||||
RINKEBY = 4
|
RINKEBY = 4
|
||||||
KOVAN = 42
|
KOVAN = 42
|
||||||
GANACHE = 50
|
GANACHE = 1337
|
||||||
|
|
||||||
|
|
||||||
class _AddressCache:
|
class _AddressCache:
|
||||||
@ -106,35 +106,35 @@ class _AddressCache:
|
|||||||
# pylint: disable=too-few-public-methods
|
# pylint: disable=too-few-public-methods
|
||||||
|
|
||||||
# class data, not instance:
|
# class data, not instance:
|
||||||
_network_to_addresses: Dict[str, ContractAddresses] = {}
|
_chain_to_addresses: Dict[str, ContractAddresses] = {}
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def network_to_addresses(cls, network_id: NetworkId):
|
def chain_to_addresses(cls, chain_id: ChainId):
|
||||||
"""Return the addresses for the given network ID.
|
"""Return the addresses for the given chain ID.
|
||||||
|
|
||||||
First tries to get data from the class level storage
|
First tries to get data from the class level storage
|
||||||
`_network_to_addresses`. If it's not there, loads it from disk, stores
|
`_chain_to_addresses`. If it's not there, loads it from disk, stores
|
||||||
it in the class data (for the next caller), and then returns it.
|
it in the class data (for the next caller), and then returns it.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
return cls._network_to_addresses[str(network_id.value)]
|
return cls._chain_to_addresses[str(chain_id.value)]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
cls._network_to_addresses = json.loads(
|
cls._chain_to_addresses = json.loads(
|
||||||
resource_string("zero_ex.contract_addresses", "addresses.json")
|
resource_string("zero_ex.contract_addresses", "addresses.json")
|
||||||
)
|
)
|
||||||
return cls._network_to_addresses[str(network_id.value)]
|
return cls._chain_to_addresses[str(chain_id.value)]
|
||||||
|
|
||||||
|
|
||||||
def network_to_addresses(network_id: NetworkId) -> ContractAddresses:
|
def chain_to_addresses(chain_id: ChainId) -> ContractAddresses:
|
||||||
"""Map a NetworkId to an instance of ContractAddresses.
|
"""Map a ChainId to an instance of ContractAddresses.
|
||||||
|
|
||||||
Addresses under NetworkId.Ganache are from our Ganache snapshot generated
|
Addresses under ChainId.Ganache are from our Ganache snapshot generated
|
||||||
from npm package @0x/migrations.
|
from npm package @0x/migrations.
|
||||||
|
|
||||||
>>> network_to_addresses(NetworkId.MAINNET).exchange
|
>>> chain_to_addresses(ChainId.MAINNET).exchange
|
||||||
'0x...'
|
'0x...'
|
||||||
"""
|
"""
|
||||||
addresses = _AddressCache.network_to_addresses(network_id)
|
addresses = _AddressCache.chain_to_addresses(chain_id)
|
||||||
|
|
||||||
return ContractAddresses(
|
return ContractAddresses(
|
||||||
erc20_proxy=addresses["erc20Proxy"],
|
erc20_proxy=addresses["erc20Proxy"],
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
- Expanded documentation examples.
|
- Expanded documentation examples.
|
||||||
- Moved methods `jsdict_to_order()` and `order_to_jsdict()` from `zero_ex.contract_wrappers.exchange.types` to `zero_ex.contract_wrappers.order_conversions`.
|
- Moved methods `jsdict_to_order()` and `order_to_jsdict()` from `zero_ex.contract_wrappers.exchange.types` to `zero_ex.contract_wrappers.order_conversions`.
|
||||||
- Changed field name `zero_ex.contract_wrappers.tx_params.TxParams.gasPrice` to `.gas_price`.
|
- Changed field name `zero_ex.contract_wrappers.tx_params.TxParams.gasPrice` to `.gas_price`.
|
||||||
|
- Migrated to new version of 0x-contract-addresses.
|
||||||
|
|
||||||
## 1.1.0 - 2019-08-14
|
## 1.1.0 - 2019-08-14
|
||||||
|
|
||||||
|
@ -48,14 +48,14 @@ Contract Addresses
|
|||||||
|
|
||||||
The `0x-contract-addresses`:code: package (which is used by
|
The `0x-contract-addresses`:code: package (which is used by
|
||||||
`0x-contract-wrappers`:code: and thus gets installed along with it) provides
|
`0x-contract-wrappers`:code: and thus gets installed along with it) provides
|
||||||
the addresses of the 0x contracts on each network, including those that come
|
the addresses of the 0x contracts on each chain, including those that come
|
||||||
pre-deployed deployed in the `0xorg/ganache-cli`:code: docker image. Let's
|
pre-deployed deployed in the `0xorg/ganache-cli`:code: docker image. Let's
|
||||||
capture the addresses we'll use throughout the examples below:
|
capture the addresses we'll use throughout the examples below:
|
||||||
|
|
||||||
>>> from zero_ex.contract_addresses import network_to_addresses, NetworkId
|
>>> from zero_ex.contract_addresses import chain_to_addresses, ChainId
|
||||||
>>> weth_address = network_to_addresses(NetworkId.GANACHE).ether_token
|
>>> weth_address = chain_to_addresses(ChainId.GANACHE).ether_token
|
||||||
>>> zrx_address = network_to_addresses(NetworkId.GANACHE).zrx_token
|
>>> zrx_address = chain_to_addresses(ChainId.GANACHE).zrx_token
|
||||||
>>> exchange_address = network_to_addresses(NetworkId.GANACHE).exchange
|
>>> exchange_address = chain_to_addresses(ChainId.GANACHE).exchange
|
||||||
|
|
||||||
Wrapping ETH
|
Wrapping ETH
|
||||||
------------
|
------------
|
||||||
@ -93,14 +93,14 @@ balance:
|
|||||||
>>> from zero_ex.contract_wrappers.erc20_token import ERC20Token
|
>>> from zero_ex.contract_wrappers.erc20_token import ERC20Token
|
||||||
>>> zrx_token = ERC20Token(
|
>>> zrx_token = ERC20Token(
|
||||||
... web3_or_provider=ganache,
|
... web3_or_provider=ganache,
|
||||||
... contract_address=network_to_addresses(NetworkId.GANACHE).zrx_token,
|
... contract_address=chain_to_addresses(ChainId.GANACHE).zrx_token,
|
||||||
... )
|
... )
|
||||||
>>> weth_token = ERC20Token(
|
>>> weth_token = ERC20Token(
|
||||||
... web3_or_provider=ganache,
|
... web3_or_provider=ganache,
|
||||||
... contract_address=network_to_addresses(NetworkId.GANACHE).ether_token,
|
... contract_address=chain_to_addresses(ChainId.GANACHE).ether_token,
|
||||||
... )
|
... )
|
||||||
|
|
||||||
>>> erc20_proxy_addr = network_to_addresses(NetworkId.GANACHE).erc20_proxy
|
>>> erc20_proxy_addr = chain_to_addresses(ChainId.GANACHE).erc20_proxy
|
||||||
|
|
||||||
>>> tx = zrx_token.approve.send_transaction(
|
>>> tx = zrx_token.approve.send_transaction(
|
||||||
... erc20_proxy_addr,
|
... erc20_proxy_addr,
|
||||||
@ -165,7 +165,7 @@ Now we'll have our Taker fill the order.
|
|||||||
>>> from zero_ex.contract_wrappers.exchange import Exchange
|
>>> from zero_ex.contract_wrappers.exchange import Exchange
|
||||||
>>> exchange = Exchange(
|
>>> exchange = Exchange(
|
||||||
... web3_or_provider=ganache,
|
... web3_or_provider=ganache,
|
||||||
... contract_address=network_to_addresses(NetworkId.GANACHE).exchange,
|
... contract_address=chain_to_addresses(ChainId.GANACHE).exchange,
|
||||||
... )
|
... )
|
||||||
|
|
||||||
But before filling an order, one may wish to check that it's actually fillable:
|
But before filling an order, one may wish to check that it's actually fillable:
|
||||||
|
@ -5,7 +5,7 @@ from eth_utils import to_checksum_address
|
|||||||
from web3 import Web3
|
from web3 import Web3
|
||||||
|
|
||||||
from zero_ex.order_utils import asset_data_utils
|
from zero_ex.order_utils import asset_data_utils
|
||||||
from zero_ex.contract_addresses import network_to_addresses, NetworkId
|
from zero_ex.contract_addresses import chain_to_addresses, ChainId
|
||||||
from zero_ex.contract_artifacts import abi_by_name
|
from zero_ex.contract_artifacts import abi_by_name
|
||||||
|
|
||||||
|
|
||||||
@ -36,14 +36,14 @@ def accounts(web3_eth): # pylint: disable=redefined-outer-name
|
|||||||
@pytest.fixture(scope="module")
|
@pytest.fixture(scope="module")
|
||||||
def erc20_proxy_address():
|
def erc20_proxy_address():
|
||||||
"""Get the 0x ERC20 Proxy address."""
|
"""Get the 0x ERC20 Proxy address."""
|
||||||
return network_to_addresses(NetworkId.GANACHE).erc20_proxy
|
return chain_to_addresses(ChainId.GANACHE).erc20_proxy
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope="module")
|
@pytest.fixture(scope="module")
|
||||||
def weth_asset_data(): # pylint: disable=redefined-outer-name
|
def weth_asset_data(): # pylint: disable=redefined-outer-name
|
||||||
"""Get 0x asset data for Wrapped Ether (WETH) token."""
|
"""Get 0x asset data for Wrapped Ether (WETH) token."""
|
||||||
return asset_data_utils.encode_erc20(
|
return asset_data_utils.encode_erc20(
|
||||||
network_to_addresses(NetworkId.GANACHE).ether_token
|
chain_to_addresses(ChainId.GANACHE).ether_token
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ def weth_instance(web3_eth): # pylint: disable=redefined-outer-name
|
|||||||
"""Get an instance of the WrapperEther contract."""
|
"""Get an instance of the WrapperEther contract."""
|
||||||
return web3_eth.contract(
|
return web3_eth.contract(
|
||||||
address=to_checksum_address(
|
address=to_checksum_address(
|
||||||
network_to_addresses(NetworkId.GANACHE).ether_token
|
chain_to_addresses(ChainId.GANACHE).ether_token
|
||||||
),
|
),
|
||||||
abi=abi_by_name("WETH9"),
|
abi=abi_by_name("WETH9"),
|
||||||
)
|
)
|
||||||
@ -60,8 +60,8 @@ def weth_instance(web3_eth): # pylint: disable=redefined-outer-name
|
|||||||
|
|
||||||
@pytest.fixture(scope="module")
|
@pytest.fixture(scope="module")
|
||||||
def zrx_address():
|
def zrx_address():
|
||||||
"""Get address of ZRX token for Ganache network."""
|
"""Get address of ZRX token for Ganache chain."""
|
||||||
return network_to_addresses(NetworkId.GANACHE).zrx_token
|
return chain_to_addresses(ChainId.GANACHE).zrx_token
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope="module")
|
@pytest.fixture(scope="module")
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from zero_ex.contract_addresses import network_to_addresses, NetworkId
|
from zero_ex.contract_addresses import chain_to_addresses, ChainId
|
||||||
from zero_ex.contract_wrappers.bases import ContractMethod
|
from zero_ex.contract_wrappers.bases import ContractMethod
|
||||||
|
|
||||||
|
|
||||||
@ -11,5 +11,5 @@ def contract_wrapper(ganache_provider):
|
|||||||
"""Get a ContractMethod instance for testing."""
|
"""Get a ContractMethod instance for testing."""
|
||||||
return ContractMethod(
|
return ContractMethod(
|
||||||
web3_or_provider=ganache_provider,
|
web3_or_provider=ganache_provider,
|
||||||
contract_address=network_to_addresses(NetworkId.GANACHE).ether_token,
|
contract_address=chain_to_addresses(ChainId.GANACHE).ether_token,
|
||||||
)
|
)
|
||||||
|
@ -4,7 +4,7 @@ from decimal import Decimal
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from zero_ex.contract_addresses import network_to_addresses, NetworkId
|
from zero_ex.contract_addresses import chain_to_addresses, ChainId
|
||||||
from zero_ex.contract_wrappers import TxParams
|
from zero_ex.contract_wrappers import TxParams
|
||||||
from zero_ex.contract_wrappers.erc20_token import ERC20Token
|
from zero_ex.contract_wrappers.erc20_token import ERC20Token
|
||||||
|
|
||||||
@ -16,7 +16,7 @@ MAX_ALLOWANCE = int("{:.0f}".format(Decimal(2) ** 256 - 1))
|
|||||||
def erc20_wrapper(ganache_provider):
|
def erc20_wrapper(ganache_provider):
|
||||||
"""Get an instance of ERC20Token wrapper class for testing."""
|
"""Get an instance of ERC20Token wrapper class for testing."""
|
||||||
return ERC20Token(
|
return ERC20Token(
|
||||||
ganache_provider, network_to_addresses(NetworkId.GANACHE).ether_token
|
ganache_provider, chain_to_addresses(ChainId.GANACHE).ether_token
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ import random
|
|||||||
import pytest
|
import pytest
|
||||||
from eth_utils import remove_0x_prefix
|
from eth_utils import remove_0x_prefix
|
||||||
|
|
||||||
from zero_ex.contract_addresses import network_to_addresses, NetworkId
|
from zero_ex.contract_addresses import chain_to_addresses, ChainId
|
||||||
from zero_ex.contract_wrappers import TxParams
|
from zero_ex.contract_wrappers import TxParams
|
||||||
from zero_ex.contract_wrappers.exchange import Exchange
|
from zero_ex.contract_wrappers.exchange import Exchange
|
||||||
from zero_ex.contract_wrappers.exchange.types import Order
|
from zero_ex.contract_wrappers.exchange.types import Order
|
||||||
@ -22,7 +22,7 @@ def exchange_wrapper(ganache_provider):
|
|||||||
"""Get an Exchange wrapper instance."""
|
"""Get an Exchange wrapper instance."""
|
||||||
return Exchange(
|
return Exchange(
|
||||||
web3_or_provider=ganache_provider,
|
web3_or_provider=ganache_provider,
|
||||||
contract_address=network_to_addresses(NetworkId.GANACHE).exchange,
|
contract_address=chain_to_addresses(ChainId.GANACHE).exchange,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -161,8 +161,8 @@ def test_two_instantiations_with_web3_objects(web3_instance):
|
|||||||
again." Test that that bug isn't occurring.
|
again." Test that that bug isn't occurring.
|
||||||
"""
|
"""
|
||||||
exchange = Exchange( # pylint: disable=unused-variable
|
exchange = Exchange( # pylint: disable=unused-variable
|
||||||
web3_instance, network_to_addresses(NetworkId.GANACHE).exchange
|
web3_instance, chain_to_addresses(ChainId.GANACHE).exchange
|
||||||
)
|
)
|
||||||
exchange2 = Exchange( # pylint: disable=unused-variable
|
exchange2 = Exchange( # pylint: disable=unused-variable
|
||||||
web3_instance, network_to_addresses(NetworkId.GANACHE).exchange
|
web3_instance, chain_to_addresses(ChainId.GANACHE).exchange
|
||||||
)
|
)
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
## 1.1.1 - TBD
|
## 1.2.0 - TBD
|
||||||
|
|
||||||
- Removed dev dependency on package `0x-contract-wrappers`
|
- Removed dev dependency on package `0x-contract-wrappers`
|
||||||
|
- Migrated examples to using new version of `0x-contract-addresses`.
|
||||||
|
|
||||||
## 1.1.0 - 2019-08-09
|
## 1.1.0 - 2019-08-09
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ def assert_valid(data: Mapping, schema_id: str) -> None:
|
|||||||
Raises an exception if validation fails.
|
Raises an exception if validation fails.
|
||||||
|
|
||||||
>>> from zero_ex.json_schemas import assert_valid
|
>>> from zero_ex.json_schemas import assert_valid
|
||||||
>>> from zero_ex.contract_addresses import network_to_addresses, NetworkId
|
>>> from zero_ex.contract_addresses import chain_to_addresses, ChainId
|
||||||
>>> from eth_utils import remove_0x_prefix
|
>>> from eth_utils import remove_0x_prefix
|
||||||
>>> import random
|
>>> import random
|
||||||
>>> from datetime import datetime, timedelta
|
>>> from datetime import datetime, timedelta
|
||||||
@ -73,10 +73,10 @@ def assert_valid(data: Mapping, schema_id: str) -> None:
|
|||||||
... '0x0000000000000000000000000000000000000000'
|
... '0x0000000000000000000000000000000000000000'
|
||||||
... ),
|
... ),
|
||||||
... 'makerAssetData': (
|
... 'makerAssetData': (
|
||||||
... network_to_addresses(NetworkId.MAINNET).zrx_token
|
... chain_to_addresses(ChainId.MAINNET).zrx_token
|
||||||
... ),
|
... ),
|
||||||
... 'takerAssetData': (
|
... 'takerAssetData': (
|
||||||
... network_to_addresses(NetworkId.MAINNET).ether_token
|
... chain_to_addresses(ChainId.MAINNET).ether_token
|
||||||
... ),
|
... ),
|
||||||
... 'salt': random.randint(1, 100000000000000000),
|
... 'salt': random.randint(1, 100000000000000000),
|
||||||
... 'makerFee': 0,
|
... 'makerFee': 0,
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
from eth_utils import to_checksum_address
|
from eth_utils import to_checksum_address
|
||||||
from web3 import Web3, HTTPProvider
|
from web3 import Web3, HTTPProvider
|
||||||
|
|
||||||
from zero_ex.contract_addresses import network_to_addresses, NetworkId
|
from zero_ex.contract_addresses import chain_to_addresses, ChainId
|
||||||
from zero_ex.middlewares.local_message_signer import (
|
from zero_ex.middlewares.local_message_signer import (
|
||||||
construct_local_message_signer,
|
construct_local_message_signer,
|
||||||
)
|
)
|
||||||
@ -17,7 +17,7 @@ def test_local_message_signer__sign_order():
|
|||||||
"d6db0157d9dfe9f9fadb8dedabb7786352843357f4ec8d0fbcbeeb619b1091f5803"
|
"d6db0157d9dfe9f9fadb8dedabb7786352843357f4ec8d0fbcbeeb619b1091f5803"
|
||||||
)
|
)
|
||||||
address = "0x5409ED021D9299bf6814279A6A1411A7e866A631"
|
address = "0x5409ED021D9299bf6814279A6A1411A7e866A631"
|
||||||
exchange = network_to_addresses(NetworkId.GANACHE).exchange
|
exchange = chain_to_addresses(ChainId.GANACHE).exchange
|
||||||
private_key = (
|
private_key = (
|
||||||
"f2f48ee19680706196e2e339e5da3491186e0c4c5030670656b0e0164837257d"
|
"f2f48ee19680706196e2e339e5da3491186e0c4c5030670656b0e0164837257d"
|
||||||
)
|
)
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
- Upgraded to protocol version 3.
|
- Upgraded to protocol version 3.
|
||||||
- `is_valid_signature()` now returns just a boolean. (Formerly, it returned a tuple consisting of the boolean and a reason string.)
|
- `is_valid_signature()` now returns just a boolean. (Formerly, it returned a tuple consisting of the boolean and a reason string.)
|
||||||
- Allow `sign_hash()` to be called with EITHER a Web3.py `BaseProvider` OR an already-instantiated `Web3` client object.
|
- Allow `sign_hash()` to be called with EITHER a Web3.py `BaseProvider` OR an already-instantiated `Web3` client object.
|
||||||
|
- Migrated to new version of `0x-contract-addresses`.
|
||||||
|
|
||||||
## 3.0.1 - 2019-08-09
|
## 3.0.1 - 2019-08-09
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ import web3.exceptions
|
|||||||
from web3.providers.base import BaseProvider
|
from web3.providers.base import BaseProvider
|
||||||
from web3.contract import Contract
|
from web3.contract import Contract
|
||||||
|
|
||||||
from zero_ex.contract_addresses import network_to_addresses, NetworkId
|
from zero_ex.contract_addresses import chain_to_addresses, ChainId
|
||||||
import zero_ex.contract_artifacts
|
import zero_ex.contract_artifacts
|
||||||
from zero_ex.contract_wrappers.exchange import Exchange
|
from zero_ex.contract_wrappers.exchange import Exchange
|
||||||
from zero_ex.contract_wrappers.exchange.types import Order
|
from zero_ex.contract_wrappers.exchange.types import Order
|
||||||
@ -127,9 +127,9 @@ def generate_order_hash_hex(
|
|||||||
... takerFeeAssetData=((0).to_bytes(1, byteorder='big') * 20),
|
... takerFeeAssetData=((0).to_bytes(1, byteorder='big') * 20),
|
||||||
... ),
|
... ),
|
||||||
... exchange_address="0x1dc4c1cefef38a777b15aa20260a54e584b16c48",
|
... exchange_address="0x1dc4c1cefef38a777b15aa20260a54e584b16c48",
|
||||||
... chain_id=50
|
... chain_id=1337
|
||||||
... )
|
... )
|
||||||
'331cb7e07a757bae130702da6646c26531798c92bcfaf671817268fd2c188531'
|
'cb36e4fedb36508fb707e2c05e21bffc7a72766ccae93f8ff096693fff7f1714'
|
||||||
""" # noqa: E501 (line too long)
|
""" # noqa: E501 (line too long)
|
||||||
assert_is_address(exchange_address, "exchange_address")
|
assert_is_address(exchange_address, "exchange_address")
|
||||||
assert_valid(
|
assert_valid(
|
||||||
@ -211,9 +211,9 @@ def is_valid_signature(
|
|||||||
|
|
||||||
return Exchange(
|
return Exchange(
|
||||||
provider,
|
provider,
|
||||||
network_to_addresses(
|
chain_to_addresses(
|
||||||
NetworkId(
|
ChainId(
|
||||||
int(Web3(provider).net.version) # pylint: disable=no-member
|
int(Web3(provider).eth.chainId) # pylint: disable=no-member
|
||||||
)
|
)
|
||||||
).exchange,
|
).exchange,
|
||||||
).is_valid_hash_signature.call(
|
).is_valid_hash_signature.call(
|
||||||
|
@ -21,11 +21,14 @@ class Web3:
|
|||||||
version: str
|
version: str
|
||||||
...
|
...
|
||||||
|
|
||||||
class eth:
|
class Eth:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def contract(address: str, abi: Dict) -> Contract: ...
|
def contract(address: str, abi: Dict) -> Contract: ...
|
||||||
|
chainId: int
|
||||||
...
|
...
|
||||||
|
|
||||||
|
eth: Eth
|
||||||
|
|
||||||
class geth:
|
class geth:
|
||||||
class personal:
|
class personal:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -69,10 +69,10 @@ To start, connect to the Ethereum network:
|
|||||||
>>> from web3 import HTTPProvider, Web3
|
>>> from web3 import HTTPProvider, Web3
|
||||||
>>> eth_node = HTTPProvider("http://localhost:8545")
|
>>> eth_node = HTTPProvider("http://localhost:8545")
|
||||||
|
|
||||||
What network is it?
|
What chain are we on?
|
||||||
|
|
||||||
>>> from zero_ex.contract_addresses import NetworkId
|
>>> from zero_ex.contract_addresses import ChainId
|
||||||
>>> network_id = NetworkId.GANACHE # you might use .MAINNET or .KOVAN
|
>>> chain_id = ChainId.GANACHE # you might use .MAINNET or .KOVAN
|
||||||
|
|
||||||
For our Maker role, we'll just use the first address available in the node:
|
For our Maker role, we'll just use the first address available in the node:
|
||||||
|
|
||||||
@ -83,8 +83,8 @@ for this account, so the example orders below have the maker trading away ZRX.
|
|||||||
Before such an order can be valid, though, the maker must give the 0x contracts
|
Before such an order can be valid, though, the maker must give the 0x contracts
|
||||||
permission to trade their ZRX tokens:
|
permission to trade their ZRX tokens:
|
||||||
|
|
||||||
>>> from zero_ex.contract_addresses import network_to_addresses
|
>>> from zero_ex.contract_addresses import chain_to_addresses
|
||||||
>>> contract_addresses = network_to_addresses(network_id)
|
>>> contract_addresses = chain_to_addresses(chain_id)
|
||||||
>>>
|
>>>
|
||||||
>>> from zero_ex.contract_artifacts import abi_by_name
|
>>> from zero_ex.contract_artifacts import abi_by_name
|
||||||
>>> zrx_token_contract = Web3(eth_node).eth.contract(
|
>>> zrx_token_contract = Web3(eth_node).eth.contract(
|
||||||
@ -141,7 +141,7 @@ Post an order for our Maker to trade ZRX for WETH:
|
|||||||
... order, contract_addresses.exchange, Web3(eth_node).eth.chainId
|
... order, contract_addresses.exchange, Web3(eth_node).eth.chainId
|
||||||
... )
|
... )
|
||||||
>>> relayer.post_order_with_http_info(
|
>>> relayer.post_order_with_http_info(
|
||||||
... network_id=network_id.value,
|
... chain_id=chain_id.value,
|
||||||
... signed_order_schema=order_to_jsdict(
|
... signed_order_schema=order_to_jsdict(
|
||||||
... order=order,
|
... order=order,
|
||||||
... exchange_address=contract_addresses.exchange,
|
... exchange_address=contract_addresses.exchange,
|
||||||
@ -346,7 +346,7 @@ book. Now let's have the taker fill it:
|
|||||||
>>> from zero_ex.order_utils import Order
|
>>> from zero_ex.order_utils import Order
|
||||||
>>> exchange = Exchange(
|
>>> exchange = Exchange(
|
||||||
... web3_or_provider=eth_node,
|
... web3_or_provider=eth_node,
|
||||||
... contract_address=network_to_addresses(NetworkId.GANACHE).exchange
|
... contract_address=chain_to_addresses(ChainId.GANACHE).exchange
|
||||||
... )
|
... )
|
||||||
|
|
||||||
(Due to `an Issue with the Launch Kit Backend
|
(Due to `an Issue with the Launch Kit Backend
|
||||||
|
@ -42,7 +42,7 @@ class DefaultApi(object):
|
|||||||
:param bool async_req: Whether request should be asynchronous.
|
:param bool async_req: Whether request should be asynchronous.
|
||||||
:param str asset_data_a: The assetData value for the first asset in the pair.
|
:param str asset_data_a: The assetData value for the first asset in the pair.
|
||||||
:param str asset_data_b: The assetData value for the second asset in the pair.
|
:param str asset_data_b: The assetData value for the second asset in the pair.
|
||||||
:param int network_id: The id of the Ethereum network
|
:param int chain_id: The id of the Ethereum chain
|
||||||
:param int page: The number of the page to request in the collection.
|
:param int page: The number of the page to request in the collection.
|
||||||
:param int per_page: The number of records to return per page.
|
:param int per_page: The number of records to return per page.
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ class DefaultApi(object):
|
|||||||
:param bool async_req: Whether request should be asynchronous.
|
:param bool async_req: Whether request should be asynchronous.
|
||||||
:param str asset_data_a: The assetData value for the first asset in the pair.
|
:param str asset_data_a: The assetData value for the first asset in the pair.
|
||||||
:param str asset_data_b: The assetData value for the second asset in the pair.
|
:param str asset_data_b: The assetData value for the second asset in the pair.
|
||||||
:param int network_id: The id of the Ethereum network
|
:param int chain_id: The id of the Ethereum chain
|
||||||
:param int page: The number of the page to request in the collection.
|
:param int page: The number of the page to request in the collection.
|
||||||
:param int per_page: The number of records to return per page.
|
:param int per_page: The number of records to return per page.
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ class DefaultApi(object):
|
|||||||
all_params = [
|
all_params = [
|
||||||
"asset_data_a",
|
"asset_data_a",
|
||||||
"asset_data_b",
|
"asset_data_b",
|
||||||
"network_id",
|
"chain_id",
|
||||||
"page",
|
"page",
|
||||||
"per_page",
|
"per_page",
|
||||||
]
|
]
|
||||||
@ -117,8 +117,8 @@ class DefaultApi(object):
|
|||||||
query_params.append(
|
query_params.append(
|
||||||
("assetDataB", local_var_params["asset_data_b"])
|
("assetDataB", local_var_params["asset_data_b"])
|
||||||
)
|
)
|
||||||
if "network_id" in local_var_params:
|
if "chain_id" in local_var_params:
|
||||||
query_params.append(("networkId", local_var_params["network_id"]))
|
query_params.append(("chainId", local_var_params["chain_id"]))
|
||||||
if "page" in local_var_params:
|
if "page" in local_var_params:
|
||||||
query_params.append(("page", local_var_params["page"]))
|
query_params.append(("page", local_var_params["page"]))
|
||||||
if "per_page" in local_var_params:
|
if "per_page" in local_var_params:
|
||||||
@ -170,7 +170,7 @@ class DefaultApi(object):
|
|||||||
>>> result = thread.get() # doctest: +SKIP
|
>>> result = thread.get() # doctest: +SKIP
|
||||||
|
|
||||||
:param bool async_req: Whether request should be asynchronous.
|
:param bool async_req: Whether request should be asynchronous.
|
||||||
:param int network_id: The id of the Ethereum network
|
:param int chain_id: The id of the Ethereum chain
|
||||||
:param int page: The number of the page to request in the collection.
|
:param int page: The number of the page to request in the collection.
|
||||||
:param int per_page: The number of records to return per page.
|
:param int per_page: The number of records to return per page.
|
||||||
|
|
||||||
@ -196,7 +196,7 @@ class DefaultApi(object):
|
|||||||
>>> result = thread.get() # doctest: +SKIP
|
>>> result = thread.get() # doctest: +SKIP
|
||||||
|
|
||||||
:param bool async_req: Whether request should be asynchronous.
|
:param bool async_req: Whether request should be asynchronous.
|
||||||
:param int network_id: The id of the Ethereum network
|
:param int chain_id: The id of the Ethereum chain
|
||||||
:param int page: The number of the page to request in the collection.
|
:param int page: The number of the page to request in the collection.
|
||||||
:param int per_page: The number of records to return per page.
|
:param int per_page: The number of records to return per page.
|
||||||
|
|
||||||
@ -208,7 +208,7 @@ class DefaultApi(object):
|
|||||||
|
|
||||||
local_var_params = locals()
|
local_var_params = locals()
|
||||||
|
|
||||||
all_params = ["network_id", "page", "per_page"]
|
all_params = ["chain_id", "page", "per_page"]
|
||||||
all_params.append("async_req")
|
all_params.append("async_req")
|
||||||
all_params.append("_return_http_data_only")
|
all_params.append("_return_http_data_only")
|
||||||
all_params.append("_preload_content")
|
all_params.append("_preload_content")
|
||||||
@ -228,8 +228,8 @@ class DefaultApi(object):
|
|||||||
path_params = {}
|
path_params = {}
|
||||||
|
|
||||||
query_params = []
|
query_params = []
|
||||||
if "network_id" in local_var_params:
|
if "chain_id" in local_var_params:
|
||||||
query_params.append(("networkId", local_var_params["network_id"]))
|
query_params.append(("chainId", local_var_params["chain_id"]))
|
||||||
if "page" in local_var_params:
|
if "page" in local_var_params:
|
||||||
query_params.append(("page", local_var_params["page"]))
|
query_params.append(("page", local_var_params["page"]))
|
||||||
if "per_page" in local_var_params:
|
if "per_page" in local_var_params:
|
||||||
@ -281,7 +281,7 @@ class DefaultApi(object):
|
|||||||
|
|
||||||
:param bool async_req: Whether request should be asynchronous.
|
:param bool async_req: Whether request should be asynchronous.
|
||||||
:param str order_hash: The hash of the desired 0x order. (required)
|
:param str order_hash: The hash of the desired 0x order. (required)
|
||||||
:param int network_id: The id of the Ethereum network
|
:param int chain_id: The id of the Ethereum chain
|
||||||
|
|
||||||
:return: :class:`RelayerApiOrderSchema`.
|
:return: :class:`RelayerApiOrderSchema`.
|
||||||
If the method is called asynchronously, returns the request thread.
|
If the method is called asynchronously, returns the request thread.
|
||||||
@ -305,7 +305,7 @@ class DefaultApi(object):
|
|||||||
|
|
||||||
:param bool async_req: Whether request should be asynchronous.
|
:param bool async_req: Whether request should be asynchronous.
|
||||||
:param str order_hash: The hash of the desired 0x order. (required)
|
:param str order_hash: The hash of the desired 0x order. (required)
|
||||||
:param int network_id: The id of the Ethereum network
|
:param int chain_id: The id of the Ethereum chain
|
||||||
|
|
||||||
:return: A tuple consisting of a
|
:return: A tuple consisting of a
|
||||||
:class:`RelayerApiOrderSchema`, an HTTP status code integer, and a
|
:class:`RelayerApiOrderSchema`, an HTTP status code integer, and a
|
||||||
@ -315,7 +315,7 @@ class DefaultApi(object):
|
|||||||
|
|
||||||
local_var_params = locals()
|
local_var_params = locals()
|
||||||
|
|
||||||
all_params = ["order_hash", "network_id"]
|
all_params = ["order_hash", "chain_id"]
|
||||||
all_params.append("async_req")
|
all_params.append("async_req")
|
||||||
all_params.append("_return_http_data_only")
|
all_params.append("_return_http_data_only")
|
||||||
all_params.append("_preload_content")
|
all_params.append("_preload_content")
|
||||||
@ -345,8 +345,8 @@ class DefaultApi(object):
|
|||||||
path_params["orderHash"] = local_var_params["order_hash"]
|
path_params["orderHash"] = local_var_params["order_hash"]
|
||||||
|
|
||||||
query_params = []
|
query_params = []
|
||||||
if "network_id" in local_var_params:
|
if "chain_id" in local_var_params:
|
||||||
query_params.append(("networkId", local_var_params["network_id"]))
|
query_params.append(("chainId", local_var_params["chain_id"]))
|
||||||
|
|
||||||
header_params = {}
|
header_params = {}
|
||||||
|
|
||||||
@ -401,7 +401,7 @@ class DefaultApi(object):
|
|||||||
>>> result = thread.get() # doctest: +SKIP
|
>>> result = thread.get() # doctest: +SKIP
|
||||||
|
|
||||||
:param bool async_req: Whether request should be asynchronous.
|
:param bool async_req: Whether request should be asynchronous.
|
||||||
:param int network_id: The id of the Ethereum network
|
:param int chain_id: The id of the Ethereum chain
|
||||||
:param relayer_api_order_config_payload_schema: instance of
|
:param relayer_api_order_config_payload_schema: instance of
|
||||||
:class:`RelayerApiOrderConfigPayloadSchema`. The fields of a 0x
|
:class:`RelayerApiOrderConfigPayloadSchema`. The fields of a 0x
|
||||||
order the relayer may want to decide what configuration to send
|
order the relayer may want to decide what configuration to send
|
||||||
@ -436,7 +436,7 @@ class DefaultApi(object):
|
|||||||
>>> result = thread.get() # doctest: +SKIP
|
>>> result = thread.get() # doctest: +SKIP
|
||||||
|
|
||||||
:param bool async_req: Whether request should be asynchronous.
|
:param bool async_req: Whether request should be asynchronous.
|
||||||
:param int network_id: The id of the Ethereum network
|
:param int chain_id: The id of the Ethereum chain
|
||||||
:param relayer_api_order_config_payload_schema: instance of
|
:param relayer_api_order_config_payload_schema: instance of
|
||||||
:class: `RelayerApiOrderConfigPayloadSchema`. The fields of a 0x
|
:class: `RelayerApiOrderConfigPayloadSchema`. The fields of a 0x
|
||||||
order the relayer may want to decide what configuration to send
|
order the relayer may want to decide what configuration to send
|
||||||
@ -450,7 +450,7 @@ class DefaultApi(object):
|
|||||||
|
|
||||||
local_var_params = locals()
|
local_var_params = locals()
|
||||||
|
|
||||||
all_params = ["network_id", "relayer_api_order_config_payload_schema"]
|
all_params = ["chain_id", "relayer_api_order_config_payload_schema"]
|
||||||
all_params.append("async_req")
|
all_params.append("async_req")
|
||||||
all_params.append("_return_http_data_only")
|
all_params.append("_return_http_data_only")
|
||||||
all_params.append("_preload_content")
|
all_params.append("_preload_content")
|
||||||
@ -470,8 +470,8 @@ class DefaultApi(object):
|
|||||||
path_params = {}
|
path_params = {}
|
||||||
|
|
||||||
query_params = []
|
query_params = []
|
||||||
if "network_id" in local_var_params:
|
if "chain_id" in local_var_params:
|
||||||
query_params.append(("networkId", local_var_params["network_id"]))
|
query_params.append(("chainId", local_var_params["chain_id"]))
|
||||||
|
|
||||||
header_params = {}
|
header_params = {}
|
||||||
|
|
||||||
@ -545,7 +545,7 @@ class DefaultApi(object):
|
|||||||
:param str quote_asset_data: assetData (makerAssetData or
|
:param str quote_asset_data: assetData (makerAssetData or
|
||||||
takerAssetData) designated as the quote currency in the currency
|
takerAssetData) designated as the quote currency in the currency
|
||||||
pair calculation of price. (required)
|
pair calculation of price. (required)
|
||||||
:param int network_id: The id of the Ethereum network
|
:param int chain_id: The id of the Ethereum chain
|
||||||
:param int page: The number of the page to request in the collection.
|
:param int page: The number of the page to request in the collection.
|
||||||
:param int per_page: The number of records to return per page.
|
:param int per_page: The number of records to return per page.
|
||||||
|
|
||||||
@ -594,7 +594,7 @@ class DefaultApi(object):
|
|||||||
:param str quote_asset_data: assetData (makerAssetData or
|
:param str quote_asset_data: assetData (makerAssetData or
|
||||||
takerAssetData) designated as the quote currency in the currency
|
takerAssetData) designated as the quote currency in the currency
|
||||||
pair calculation of price. (required)
|
pair calculation of price. (required)
|
||||||
:param int network_id: The id of the Ethereum network
|
:param int chain_id: The id of the Ethereum chain
|
||||||
:param int page: The number of the page to request in the collection.
|
:param int page: The number of the page to request in the collection.
|
||||||
:param int per_page: The number of records to return per page.
|
:param int per_page: The number of records to return per page.
|
||||||
|
|
||||||
@ -609,7 +609,7 @@ class DefaultApi(object):
|
|||||||
all_params = [
|
all_params = [
|
||||||
"base_asset_data",
|
"base_asset_data",
|
||||||
"quote_asset_data",
|
"quote_asset_data",
|
||||||
"network_id",
|
"chain_id",
|
||||||
"page",
|
"page",
|
||||||
"per_page",
|
"per_page",
|
||||||
]
|
]
|
||||||
@ -658,8 +658,8 @@ class DefaultApi(object):
|
|||||||
query_params.append(
|
query_params.append(
|
||||||
("quoteAssetData", local_var_params["quote_asset_data"])
|
("quoteAssetData", local_var_params["quote_asset_data"])
|
||||||
)
|
)
|
||||||
if "network_id" in local_var_params:
|
if "chain_id" in local_var_params:
|
||||||
query_params.append(("networkId", local_var_params["network_id"]))
|
query_params.append(("chainId", local_var_params["chain_id"]))
|
||||||
if "page" in local_var_params:
|
if "page" in local_var_params:
|
||||||
query_params.append(("page", local_var_params["page"]))
|
query_params.append(("page", local_var_params["page"]))
|
||||||
if "per_page" in local_var_params:
|
if "per_page" in local_var_params:
|
||||||
@ -760,7 +760,7 @@ class DefaultApi(object):
|
|||||||
`0x Protocol v3 Specification
|
`0x Protocol v3 Specification
|
||||||
<https://github.com/0xProject/0x-protocol-specification/blob/
|
<https://github.com/0xProject/0x-protocol-specification/blob/
|
||||||
master/v3/v3-specification.md#order-message-format>`__
|
master/v3/v3-specification.md#order-message-format>`__
|
||||||
:param int network_id: The id of the Ethereum network
|
:param int chain_id: The id of the Ethereum chain
|
||||||
:param int page: The number of the page to request in the collection.
|
:param int page: The number of the page to request in the collection.
|
||||||
:param int per_page: The number of records to return per page.
|
:param int per_page: The number of records to return per page.
|
||||||
|
|
||||||
@ -837,7 +837,7 @@ class DefaultApi(object):
|
|||||||
`0x Protocol v3 Specification
|
`0x Protocol v3 Specification
|
||||||
<https://github.com/0xProject/0x-protocol-specification/blob/
|
<https://github.com/0xProject/0x-protocol-specification/blob/
|
||||||
master/v3/v3-specification.md#order-message-format>`__
|
master/v3/v3-specification.md#order-message-format>`__
|
||||||
:param int network_id: The id of the Ethereum network
|
:param int chain_id: The id of the Ethereum chain
|
||||||
:param int page: The number of the page to request in the collection.
|
:param int page: The number of the page to request in the collection.
|
||||||
:param int per_page: The number of records to return per page.
|
:param int per_page: The number of records to return per page.
|
||||||
|
|
||||||
@ -863,7 +863,7 @@ class DefaultApi(object):
|
|||||||
"taker_address",
|
"taker_address",
|
||||||
"trader_address",
|
"trader_address",
|
||||||
"fee_recipient_address",
|
"fee_recipient_address",
|
||||||
"network_id",
|
"chain_id",
|
||||||
"page",
|
"page",
|
||||||
"per_page",
|
"per_page",
|
||||||
]
|
]
|
||||||
@ -941,8 +941,8 @@ class DefaultApi(object):
|
|||||||
local_var_params["fee_recipient_address"],
|
local_var_params["fee_recipient_address"],
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
if "network_id" in local_var_params:
|
if "chain_id" in local_var_params:
|
||||||
query_params.append(("networkId", local_var_params["network_id"]))
|
query_params.append(("chainId", local_var_params["chain_id"]))
|
||||||
if "page" in local_var_params:
|
if "page" in local_var_params:
|
||||||
query_params.append(("page", local_var_params["page"]))
|
query_params.append(("page", local_var_params["page"]))
|
||||||
if "per_page" in local_var_params:
|
if "per_page" in local_var_params:
|
||||||
@ -993,7 +993,7 @@ class DefaultApi(object):
|
|||||||
>>> result = thread.get() # doctest: +SKIP
|
>>> result = thread.get() # doctest: +SKIP
|
||||||
|
|
||||||
:param bool async_req: Whether request should be asynchronous.
|
:param bool async_req: Whether request should be asynchronous.
|
||||||
:param int network_id: The id of the Ethereum network
|
:param int chain_id: The id of the Ethereum chain
|
||||||
:param signed_order_schema: Instance of :class:`SignedOrderSchema`.
|
:param signed_order_schema: Instance of :class:`SignedOrderSchema`.
|
||||||
A valid signed 0x order based on the schema.
|
A valid signed 0x order based on the schema.
|
||||||
|
|
||||||
@ -1018,7 +1018,7 @@ class DefaultApi(object):
|
|||||||
>>> result = thread.get() # doctest: +SKIP
|
>>> result = thread.get() # doctest: +SKIP
|
||||||
|
|
||||||
:param bool async_req: Whether request should be asynchronous.
|
:param bool async_req: Whether request should be asynchronous.
|
||||||
:param int network_id: The id of the Ethereum network
|
:param int chain_id: The id of the Ethereum chain
|
||||||
:param signed_order_schema: Instance of :class:`SignedOrderSchema`
|
:param signed_order_schema: Instance of :class:`SignedOrderSchema`
|
||||||
A valid signed 0x order based on the schema.
|
A valid signed 0x order based on the schema.
|
||||||
|
|
||||||
@ -1030,7 +1030,7 @@ class DefaultApi(object):
|
|||||||
|
|
||||||
local_var_params = locals()
|
local_var_params = locals()
|
||||||
|
|
||||||
all_params = ["network_id", "signed_order_schema"]
|
all_params = ["chain_id", "signed_order_schema"]
|
||||||
all_params.append("async_req")
|
all_params.append("async_req")
|
||||||
all_params.append("_return_http_data_only")
|
all_params.append("_return_http_data_only")
|
||||||
all_params.append("_preload_content")
|
all_params.append("_preload_content")
|
||||||
@ -1050,8 +1050,8 @@ class DefaultApi(object):
|
|||||||
path_params = {}
|
path_params = {}
|
||||||
|
|
||||||
query_params = []
|
query_params = []
|
||||||
if "network_id" in local_var_params:
|
if "chain_id" in local_var_params:
|
||||||
query_params.append(("networkId", local_var_params["network_id"]))
|
query_params.append(("chainId", local_var_params["chain_id"]))
|
||||||
|
|
||||||
header_params = {}
|
header_params = {}
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ class RelayerApiOrdersChannelSubscribePayloadSchema(object):
|
|||||||
openapi_types = {
|
openapi_types = {
|
||||||
"maker_asset_proxy_id": "str",
|
"maker_asset_proxy_id": "str",
|
||||||
"taker_asset_proxy_id": "str",
|
"taker_asset_proxy_id": "str",
|
||||||
"network_id": "float",
|
"chain_id": "float",
|
||||||
"maker_asset_address": "str",
|
"maker_asset_address": "str",
|
||||||
"taker_asset_address": "str",
|
"taker_asset_address": "str",
|
||||||
"maker_asset_data": "str",
|
"maker_asset_data": "str",
|
||||||
@ -35,7 +35,7 @@ class RelayerApiOrdersChannelSubscribePayloadSchema(object):
|
|||||||
attribute_map = {
|
attribute_map = {
|
||||||
"maker_asset_proxy_id": "makerAssetProxyId",
|
"maker_asset_proxy_id": "makerAssetProxyId",
|
||||||
"taker_asset_proxy_id": "takerAssetProxyId",
|
"taker_asset_proxy_id": "takerAssetProxyId",
|
||||||
"network_id": "networkId",
|
"chain_id": "chainId",
|
||||||
"maker_asset_address": "makerAssetAddress",
|
"maker_asset_address": "makerAssetAddress",
|
||||||
"taker_asset_address": "takerAssetAddress",
|
"taker_asset_address": "takerAssetAddress",
|
||||||
"maker_asset_data": "makerAssetData",
|
"maker_asset_data": "makerAssetData",
|
||||||
@ -47,7 +47,7 @@ class RelayerApiOrdersChannelSubscribePayloadSchema(object):
|
|||||||
self,
|
self,
|
||||||
maker_asset_proxy_id=None,
|
maker_asset_proxy_id=None,
|
||||||
taker_asset_proxy_id=None,
|
taker_asset_proxy_id=None,
|
||||||
network_id=None,
|
chain_id=None,
|
||||||
maker_asset_address=None,
|
maker_asset_address=None,
|
||||||
taker_asset_address=None,
|
taker_asset_address=None,
|
||||||
maker_asset_data=None,
|
maker_asset_data=None,
|
||||||
@ -58,7 +58,7 @@ class RelayerApiOrdersChannelSubscribePayloadSchema(object):
|
|||||||
|
|
||||||
self._maker_asset_proxy_id = None
|
self._maker_asset_proxy_id = None
|
||||||
self._taker_asset_proxy_id = None
|
self._taker_asset_proxy_id = None
|
||||||
self._network_id = None
|
self._chain_id = None
|
||||||
self._maker_asset_address = None
|
self._maker_asset_address = None
|
||||||
self._taker_asset_address = None
|
self._taker_asset_address = None
|
||||||
self._maker_asset_data = None
|
self._maker_asset_data = None
|
||||||
@ -70,8 +70,8 @@ class RelayerApiOrdersChannelSubscribePayloadSchema(object):
|
|||||||
self.maker_asset_proxy_id = maker_asset_proxy_id
|
self.maker_asset_proxy_id = maker_asset_proxy_id
|
||||||
if taker_asset_proxy_id is not None:
|
if taker_asset_proxy_id is not None:
|
||||||
self.taker_asset_proxy_id = taker_asset_proxy_id
|
self.taker_asset_proxy_id = taker_asset_proxy_id
|
||||||
if network_id is not None:
|
if chain_id is not None:
|
||||||
self.network_id = network_id
|
self.chain_id = chain_id
|
||||||
if maker_asset_address is not None:
|
if maker_asset_address is not None:
|
||||||
self.maker_asset_address = maker_asset_address
|
self.maker_asset_address = maker_asset_address
|
||||||
if taker_asset_address is not None:
|
if taker_asset_address is not None:
|
||||||
@ -138,25 +138,25 @@ class RelayerApiOrdersChannelSubscribePayloadSchema(object):
|
|||||||
self._taker_asset_proxy_id = taker_asset_proxy_id
|
self._taker_asset_proxy_id = taker_asset_proxy_id
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def network_id(self):
|
def chain_id(self):
|
||||||
"""Gets the network_id of this RelayerApiOrdersChannelSubscribePayloadSchema. # noqa: E501
|
"""Gets the chain_id of this RelayerApiOrdersChannelSubscribePayloadSchema. # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
:return: The network_id of this RelayerApiOrdersChannelSubscribePayloadSchema. # noqa: E501
|
:return: The chain_id of this RelayerApiOrdersChannelSubscribePayloadSchema. # noqa: E501
|
||||||
:rtype: float
|
:rtype: float
|
||||||
"""
|
"""
|
||||||
return self._network_id
|
return self._chain_id
|
||||||
|
|
||||||
@network_id.setter
|
@chain_id.setter
|
||||||
def network_id(self, network_id):
|
def chain_id(self, chain_id):
|
||||||
"""Sets the network_id of this RelayerApiOrdersChannelSubscribePayloadSchema.
|
"""Sets the chain_id of this RelayerApiOrdersChannelSubscribePayloadSchema.
|
||||||
|
|
||||||
|
|
||||||
:param network_id: The network_id of this RelayerApiOrdersChannelSubscribePayloadSchema. # noqa: E501
|
:param chain_id: The chain_id of this RelayerApiOrdersChannelSubscribePayloadSchema. # noqa: E501
|
||||||
:type: float
|
:type: float
|
||||||
"""
|
"""
|
||||||
|
|
||||||
self._network_id = network_id
|
self._chain_id = chain_id
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def maker_asset_address(self):
|
def maker_asset_address(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user