Merge branch 'development' into refactor/remove-dev-tools-pages-fix

This commit is contained in:
xianny
2019-09-12 11:48:21 -07:00
62 changed files with 2383 additions and 1988 deletions

View File

@@ -282,6 +282,7 @@ jobs:
./install
./lint
static-tests:
resource_class: large
working_directory: ~/repo
docker:
- image: nikolaik/python-nodejs:python3.7-nodejs8

View File

@@ -104,8 +104,7 @@ describe('Mixins tests', () => {
transaction.signature.length - 2,
)}${illegalSignatureByte}`;
const transactionHash = transactionHashUtils.getTransactionHashHex(transaction);
expectContractCallFailedAsync(
mixins.getSignerAddress.callAsync(transactionHash, transaction.signature),
expect(mixins.getSignerAddress.callAsync(transactionHash, transaction.signature)).to.be.rejectedWith(
RevertReason.SignatureIllegal,
);
});
@@ -115,8 +114,7 @@ describe('Mixins tests', () => {
const invalidSignatureByte = ethUtil.toBuffer(SignatureType.Invalid).toString('hex');
transaction.signature = `0x${invalidSignatureByte}`;
const transactionHash = transactionHashUtils.getTransactionHashHex(transaction);
expectContractCallFailedAsync(
mixins.getSignerAddress.callAsync(transactionHash, transaction.signature),
expect(mixins.getSignerAddress.callAsync(transactionHash, transaction.signature)).to.be.rejectedWith(
RevertReason.SignatureInvalid,
);
});
@@ -129,8 +127,7 @@ describe('Mixins tests', () => {
transaction.signature.length - 2,
)}${invalidSignatureByte}`;
const transactionHash = transactionHashUtils.getTransactionHashHex(transaction);
expectContractCallFailedAsync(
mixins.getSignerAddress.callAsync(transactionHash, transaction.signature),
expect(mixins.getSignerAddress.callAsync(transactionHash, transaction.signature)).to.be.rejectedWith(
RevertReason.SignatureUnsupported,
);
});
@@ -193,8 +190,7 @@ describe('Mixins tests', () => {
});
it('should revert if data is less than 4 bytes long', async () => {
const data = '0x010203';
await expectContractCallFailedAsync(
mixins.decodeOrdersFromFillData.callAsync(data),
expect(mixins.decodeOrdersFromFillData.callAsync(data)).to.be.rejectedWith(
RevertReason.LibBytesGreaterOrEqualTo4LengthRequired,
);
});

View File

@@ -1,11 +1,4 @@
import {
addressUtils,
chaiSetup,
expectContractCallFailedAsync,
provider,
txDefaults,
web3Wrapper,
} from '@0x/contracts-test-utils';
import { addressUtils, chaiSetup, provider, txDefaults, web3Wrapper } from '@0x/contracts-test-utils';
import { BlockchainLifecycle } from '@0x/dev-utils';
import { RevertReason } from '@0x/types';
import { BigNumber } from '@0x/utils';
@@ -55,8 +48,7 @@ describe('LibAddressArray', () => {
const arr = _.times(3, () => addressUtils.generatePseudoRandomAddress());
const addr = addressUtils.generatePseudoRandomAddress();
const freeMemOffset = new BigNumber(-1);
return expectContractCallFailedAsync(
lib.testAppendRealloc.callAsync(arr, freeMemOffset, addr),
return expect(lib.testAppendRealloc.callAsync(arr, freeMemOffset, addr)).to.be.rejectedWith(
RevertReason.InvalidFreeMemoryPtr,
);
});

View File

@@ -1,12 +1,4 @@
import {
chaiSetup,
constants,
expectContractCallFailedAsync,
provider,
txDefaults,
typeEncodingUtils,
web3Wrapper,
} from '@0x/contracts-test-utils';
import { chaiSetup, constants, provider, txDefaults, typeEncodingUtils, web3Wrapper } from '@0x/contracts-test-utils';
import { BlockchainLifecycle } from '@0x/dev-utils';
import { generatePseudoRandomSalt } from '@0x/order-utils';
import { RevertReason } from '@0x/types';
@@ -111,8 +103,7 @@ describe('LibBytes', () => {
describe('popLastByte', () => {
it('should revert if length is 0', async () => {
return expectContractCallFailedAsync(
libBytes.publicPopLastByte.callAsync(constants.NULL_BYTES),
expect(libBytes.publicPopLastByte.callAsync(constants.NULL_BYTES)).to.be.rejectedWith(
RevertReason.LibBytesGreaterThanZeroLengthRequired,
);
});
@@ -133,8 +124,7 @@ describe('LibBytes', () => {
describe('popLast20Bytes', () => {
it('should revert if length is less than 20', async () => {
return expectContractCallFailedAsync(
libBytes.publicPopLast20Bytes.callAsync(byteArrayShorterThan20Bytes),
expect(libBytes.publicPopLast20Bytes.callAsync(byteArrayShorterThan20Bytes)).to.be.rejectedWith(
RevertReason.LibBytesGreaterOrEqualTo20LengthRequired,
);
});
@@ -208,10 +198,9 @@ describe('LibBytes', () => {
describe('deepCopyBytes', () => {
it('should revert if dest is shorter than source', async () => {
return expectContractCallFailedAsync(
return expect(
libBytes.publicDeepCopyBytes.callAsync(byteArrayShorterThan32Bytes, byteArrayLongerThan32Bytes),
RevertReason.LibBytesGreaterOrEqualToSourceBytesLengthRequired,
);
).to.be.rejectedWith(RevertReason.LibBytesGreaterOrEqualToSourceBytesLengthRequired);
});
it('should overwrite dest with source if source and dest have equal length', async () => {
const zeroedByteArrayLongerThan32Bytes = `0x${_.repeat('0', byteArrayLongerThan32Bytes.length - 2)}`;
@@ -261,16 +250,14 @@ describe('LibBytes', () => {
it('should fail if the byte array is too short to hold an address', async () => {
const shortByteArray = '0xabcdef';
const offset = new BigNumber(0);
return expectContractCallFailedAsync(
libBytes.publicReadAddress.callAsync(shortByteArray, offset),
return expect(libBytes.publicReadAddress.callAsync(shortByteArray, offset)).to.be.rejectedWith(
RevertReason.LibBytesGreaterOrEqualTo20LengthRequired,
);
});
it('should fail if the length between the offset and end of the byte array is too short to hold an address', async () => {
const byteArray = testAddress;
const badOffset = new BigNumber(ethUtil.toBuffer(byteArray).byteLength);
return expectContractCallFailedAsync(
libBytes.publicReadAddress.callAsync(byteArray, badOffset),
return expect(libBytes.publicReadAddress.callAsync(byteArray, badOffset)).to.be.rejectedWith(
RevertReason.LibBytesGreaterOrEqualTo20LengthRequired,
);
});
@@ -305,16 +292,14 @@ describe('LibBytes', () => {
});
it('should fail if the byte array is too short to hold an address', async () => {
const offset = new BigNumber(0);
return expectContractCallFailedAsync(
return expect(
libBytes.publicWriteAddress.callAsync(byteArrayShorterThan20Bytes, offset, testAddress),
RevertReason.LibBytesGreaterOrEqualTo20LengthRequired,
);
).to.be.rejectedWith(RevertReason.LibBytesGreaterOrEqualTo20LengthRequired);
});
it('should fail if the length between the offset and end of the byte array is too short to hold an address', async () => {
const byteArray = byteArrayLongerThan32Bytes;
const badOffset = new BigNumber(ethUtil.toBuffer(byteArray).byteLength);
return expectContractCallFailedAsync(
libBytes.publicWriteAddress.callAsync(byteArray, badOffset, testAddress),
return expect(libBytes.publicWriteAddress.callAsync(byteArray, badOffset, testAddress)).to.be.rejectedWith(
RevertReason.LibBytesGreaterOrEqualTo20LengthRequired,
);
});
@@ -337,15 +322,13 @@ describe('LibBytes', () => {
});
it('should fail if the byte array is too short to hold a bytes32', async () => {
const offset = new BigNumber(0);
return expectContractCallFailedAsync(
libBytes.publicReadBytes32.callAsync(byteArrayShorterThan32Bytes, offset),
return expect(libBytes.publicReadBytes32.callAsync(byteArrayShorterThan32Bytes, offset)).to.be.rejectedWith(
RevertReason.LibBytesGreaterOrEqualTo32LengthRequired,
);
});
it('should fail if the length between the offset and end of the byte array is too short to hold a bytes32', async () => {
const badOffset = new BigNumber(ethUtil.toBuffer(testBytes32).byteLength);
return expectContractCallFailedAsync(
libBytes.publicReadBytes32.callAsync(testBytes32, badOffset),
return expect(libBytes.publicReadBytes32.callAsync(testBytes32, badOffset)).to.be.rejectedWith(
RevertReason.LibBytesGreaterOrEqualTo32LengthRequired,
);
});
@@ -380,16 +363,14 @@ describe('LibBytes', () => {
});
it('should fail if the byte array is too short to hold a bytes32', async () => {
const offset = new BigNumber(0);
return expectContractCallFailedAsync(
return expect(
libBytes.publicWriteBytes32.callAsync(byteArrayShorterThan32Bytes, offset, testBytes32),
RevertReason.LibBytesGreaterOrEqualTo32LengthRequired,
);
).to.be.rejectedWith(RevertReason.LibBytesGreaterOrEqualTo32LengthRequired);
});
it('should fail if the length between the offset and end of the byte array is too short to hold a bytes32', async () => {
const byteArray = byteArrayLongerThan32Bytes;
const badOffset = new BigNumber(ethUtil.toBuffer(byteArray).byteLength);
return expectContractCallFailedAsync(
libBytes.publicWriteBytes32.callAsync(byteArray, badOffset, testBytes32),
return expect(libBytes.publicWriteBytes32.callAsync(byteArray, badOffset, testBytes32)).to.be.rejectedWith(
RevertReason.LibBytesGreaterOrEqualTo32LengthRequired,
);
});
@@ -416,8 +397,7 @@ describe('LibBytes', () => {
});
it('should fail if the byte array is too short to hold a uint256', async () => {
const offset = new BigNumber(0);
return expectContractCallFailedAsync(
libBytes.publicReadUint256.callAsync(byteArrayShorterThan32Bytes, offset),
return expect(libBytes.publicReadUint256.callAsync(byteArrayShorterThan32Bytes, offset)).to.be.rejectedWith(
RevertReason.LibBytesGreaterOrEqualTo32LengthRequired,
);
});
@@ -426,8 +406,7 @@ describe('LibBytes', () => {
const testUint256AsBuffer = ethUtil.toBuffer(formattedTestUint256);
const byteArray = ethUtil.bufferToHex(testUint256AsBuffer);
const badOffset = new BigNumber(testUint256AsBuffer.byteLength);
return expectContractCallFailedAsync(
libBytes.publicReadUint256.callAsync(byteArray, badOffset),
return expect(libBytes.publicReadUint256.callAsync(byteArray, badOffset)).to.be.rejectedWith(
RevertReason.LibBytesGreaterOrEqualTo32LengthRequired,
);
});
@@ -466,16 +445,14 @@ describe('LibBytes', () => {
});
it('should fail if the byte array is too short to hold a uint256', async () => {
const offset = new BigNumber(0);
return expectContractCallFailedAsync(
return expect(
libBytes.publicWriteUint256.callAsync(byteArrayShorterThan32Bytes, offset, testUint256),
RevertReason.LibBytesGreaterOrEqualTo32LengthRequired,
);
).to.be.rejectedWith(RevertReason.LibBytesGreaterOrEqualTo32LengthRequired);
});
it('should fail if the length between the offset and end of the byte array is too short to hold a uint256', async () => {
const byteArray = byteArrayLongerThan32Bytes;
const badOffset = new BigNumber(ethUtil.toBuffer(byteArray).byteLength);
return expectContractCallFailedAsync(
libBytes.publicWriteUint256.callAsync(byteArray, badOffset, testUint256),
return expect(libBytes.publicWriteUint256.callAsync(byteArray, badOffset, testUint256)).to.be.rejectedWith(
RevertReason.LibBytesGreaterOrEqualTo32LengthRequired,
);
});
@@ -486,8 +463,7 @@ describe('LibBytes', () => {
it('should revert if byte array has a length < 4', async () => {
const byteArrayLessThan4Bytes = '0x010101';
const offset = new BigNumber(0);
return expectContractCallFailedAsync(
libBytes.publicReadBytes4.callAsync(byteArrayLessThan4Bytes, offset),
return expect(libBytes.publicReadBytes4.callAsync(byteArrayLessThan4Bytes, offset)).to.be.rejectedWith(
RevertReason.LibBytesGreaterOrEqualTo4LengthRequired,
);
});
@@ -512,8 +488,7 @@ describe('LibBytes', () => {
});
it('should fail if the length between the offset and end of the byte array is too short to hold a bytes4', async () => {
const badOffset = new BigNumber(ethUtil.toBuffer(testBytes4).byteLength);
return expectContractCallFailedAsync(
libBytes.publicReadBytes4.callAsync(testBytes4, badOffset),
return expect(libBytes.publicReadBytes4.callAsync(testBytes4, badOffset)).to.be.rejectedWith(
RevertReason.LibBytesGreaterOrEqualTo4LengthRequired,
);
});
@@ -562,29 +537,25 @@ describe('LibBytes', () => {
it('should fail if the byte array is too short to hold the length of a nested byte array', async () => {
// The length of the nested array is 32 bytes. By storing less than 32 bytes, a length cannot be read.
const offset = new BigNumber(0);
return expectContractCallFailedAsync(
return expect(
libBytes.publicReadBytesWithLength.callAsync(byteArrayShorterThan32Bytes, offset),
RevertReason.LibBytesGreaterOrEqualTo32LengthRequired,
);
).to.be.rejectedWith(RevertReason.LibBytesGreaterOrEqualTo32LengthRequired);
});
it('should fail if we store a nested byte array length, without a nested byte array', async () => {
const offset = new BigNumber(0);
return expectContractCallFailedAsync(
libBytes.publicReadBytesWithLength.callAsync(testBytes32, offset),
return expect(libBytes.publicReadBytesWithLength.callAsync(testBytes32, offset)).to.be.rejectedWith(
RevertReason.LibBytesGreaterOrEqualToNestedBytesLengthRequired,
);
});
it('should fail if the length between the offset and end of the byte array is too short to hold the length of a nested byte array', async () => {
const badOffset = new BigNumber(ethUtil.toBuffer(byteArrayShorterThan32Bytes).byteLength);
return expectContractCallFailedAsync(
return expect(
libBytes.publicReadBytesWithLength.callAsync(byteArrayShorterThan32Bytes, badOffset),
RevertReason.LibBytesGreaterOrEqualTo32LengthRequired,
);
).to.be.rejectedWith(RevertReason.LibBytesGreaterOrEqualTo32LengthRequired);
});
it('should fail if the length between the offset and end of the byte array is too short to hold the nested byte array', async () => {
const badOffset = new BigNumber(ethUtil.toBuffer(testBytes32).byteLength);
return expectContractCallFailedAsync(
libBytes.publicReadBytesWithLength.callAsync(testBytes32, badOffset),
return expect(libBytes.publicReadBytesWithLength.callAsync(testBytes32, badOffset)).to.be.rejectedWith(
RevertReason.LibBytesGreaterOrEqualTo32LengthRequired,
);
});
@@ -695,18 +666,16 @@ describe('LibBytes', () => {
it('should fail if the byte array is too short to hold the length of a nested byte array', async () => {
const offset = new BigNumber(0);
const emptyByteArray = ethUtil.bufferToHex(new Buffer(1));
return expectContractCallFailedAsync(
return expect(
libBytes.publicWriteBytesWithLength.callAsync(emptyByteArray, offset, longData),
RevertReason.LibBytesGreaterOrEqualToNestedBytesLengthRequired,
);
).to.be.rejectedWith(RevertReason.LibBytesGreaterOrEqualToNestedBytesLengthRequired);
});
it('should fail if the length between the offset and end of the byte array is too short to hold the length of a nested byte array', async () => {
const emptyByteArray = ethUtil.bufferToHex(new Buffer(shortTestBytesAsBuffer.byteLength));
const badOffset = new BigNumber(ethUtil.toBuffer(shortTestBytesAsBuffer).byteLength);
return expectContractCallFailedAsync(
return expect(
libBytes.publicWriteBytesWithLength.callAsync(emptyByteArray, badOffset, shortData),
RevertReason.LibBytesGreaterOrEqualToNestedBytesLengthRequired,
);
).to.be.rejectedWith(RevertReason.LibBytesGreaterOrEqualToNestedBytesLengthRequired);
});
});
@@ -880,8 +849,7 @@ describe('LibBytes', () => {
it('should revert if from > to', async () => {
const from = new BigNumber(1);
const to = new BigNumber(0);
expectContractCallFailedAsync(
libBytes.publicSlice.callAsync(byteArrayLongerThan32Bytes, from, to),
expect(libBytes.publicSlice.callAsync(byteArrayLongerThan32Bytes, from, to)).to.be.rejectedWith(
RevertReason.FromLessThanToRequired,
);
});
@@ -904,8 +872,7 @@ describe('LibBytes', () => {
const byteLen = (byteArrayLongerThan32Bytes.length - 2) / 2;
const from = new BigNumber(0);
const to = new BigNumber(byteLen).plus(1);
expectContractCallFailedAsync(
libBytes.publicSlice.callAsync(byteArrayLongerThan32Bytes, from, to),
expect(libBytes.publicSlice.callAsync(byteArrayLongerThan32Bytes, from, to)).to.be.rejectedWith(
RevertReason.ToLessThanLengthRequired,
);
});
@@ -931,8 +898,7 @@ describe('LibBytes', () => {
it('should revert if from > to', async () => {
const from = new BigNumber(1);
const to = new BigNumber(0);
expectContractCallFailedAsync(
libBytes.publicSliceDestructive.callAsync(byteArrayLongerThan32Bytes, from, to),
expect(libBytes.publicSliceDestructive.callAsync(byteArrayLongerThan32Bytes, from, to)).to.be.rejectedWith(
RevertReason.FromLessThanToRequired,
);
});
@@ -953,8 +919,7 @@ describe('LibBytes', () => {
const byteLen = (byteArrayLongerThan32Bytes.length - 2) / 2;
const from = new BigNumber(0);
const to = new BigNumber(byteLen).plus(1);
expectContractCallFailedAsync(
libBytes.publicSliceDestructive.callAsync(byteArrayLongerThan32Bytes, from, to),
expect(libBytes.publicSliceDestructive.callAsync(byteArrayLongerThan32Bytes, from, to)).to.be.rejectedWith(
RevertReason.ToLessThanLengthRequired,
);
});

View File

@@ -58,11 +58,11 @@
"files": [
{
"path": "packages/0x.js/_bundles/index.min.js",
"maxSize": "800kB"
"maxSize": "1150kB"
},
{
"path": "packages/instant/umd/instant.js",
"maxSize": "1000kB"
"maxSize": "1350kB"
}
],
"ci": {

View File

@@ -49,6 +49,33 @@ Download the UMD module from our [releases page](https://github.com/0xProject/0x
<script type="text/javascript" src="0x.js"></script>
```
#### Webpack config
If bundling your project with [Webpack](https://webpack.js.org/), add the following to your `webpack.config.js`:
If building for web:
```js
node: {
fs: 'empty';
}
```
If building a node library:
```js
externals: {
fs: true;
}
```
`ContractWrappers` uses WebAssembly to simulate Ethereum calls. This toolchain involves generated 'glue' code that requires the `fs` built-in, but won't actually use it in a web environment. We tell Webpack not to resolve them since we won't need them. The specific dependency is [here](https://github.com/ethereumjs/rustbn.js/blob/master/lib/index.asm.js).
Also see:
- https://webpack.js.org/configuration/externals
- https://webpack.js.org/configuration/node
## Contributing
We strongly recommend that the community help us make improvements and determine the future direction of 0x protocol. To report bugs within this package, please create an issue in this repository.

View File

@@ -39,6 +39,13 @@ module.exports = {
}),
],
},
// This supports the ethereumjs-vm dependency in `@0x/base-contract`
// The .wasm 'glue' code generated by Emscripten requires these node builtins,
// but won't actually use them in a web environment. We tell Webpack to not resolve those
// require statements since we know we won't need them.
externals: {
fs: true,
},
module: {
rules: [
{

View File

@@ -1,4 +1,13 @@
[
{
"version": "5.3.2",
"changes": [
{
"note": "Redirect `callAsync` to use local EVM instead of eth_call for pure functions",
"pr": 2108
}
]
},
{
"timestamp": 1567521715,
"version": "5.3.1",

View File

@@ -270,6 +270,11 @@ export class AssetProxyOwnerContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(owner: string, txData?: Partial<TxData> | undefined): Promise<string> {
await (this as any).removeOwner.callAsync(owner, txData);
const txHash = await (this as any).removeOwner.sendTransactionAsync(owner, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -336,11 +341,6 @@ export class AssetProxyOwnerContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(owner: string, txData?: Partial<TxData> | undefined): Promise<string> {
await (this as any).removeOwner.callAsync(owner, txData);
const txHash = await (this as any).removeOwner.sendTransactionAsync(owner, txData);
return txHash;
},
};
/**
* Allows an owner to revoke a confirmation for a transaction.
@@ -427,6 +427,14 @@ export class AssetProxyOwnerContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(
transactionId: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).revokeConfirmation.callAsync(transactionId, txData);
const txHash = await (this as any).revokeConfirmation.sendTransactionAsync(transactionId, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -497,14 +505,6 @@ export class AssetProxyOwnerContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(
transactionId: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).revokeConfirmation.callAsync(transactionId, txData);
const txHash = await (this as any).revokeConfirmation.sendTransactionAsync(transactionId, txData);
return txHash;
},
};
public isOwner = {
/**
@@ -743,6 +743,17 @@ export class AssetProxyOwnerContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(
transactionId: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).executeRemoveAuthorizedAddressAtIndex.callAsync(transactionId, txData);
const txHash = await (this as any).executeRemoveAuthorizedAddressAtIndex.sendTransactionAsync(
transactionId,
txData,
);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -816,17 +827,6 @@ export class AssetProxyOwnerContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(
transactionId: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).executeRemoveAuthorizedAddressAtIndex.callAsync(transactionId, txData);
const txHash = await (this as any).executeRemoveAuthorizedAddressAtIndex.sendTransactionAsync(
transactionId,
txData,
);
return txHash;
},
};
public secondsTimeLocked = {
/**
@@ -1083,6 +1083,19 @@ export class AssetProxyOwnerContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(
assetProxyContract: string,
isRegistered: boolean,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).registerAssetProxy.callAsync(assetProxyContract, isRegistered, txData);
const txHash = await (this as any).registerAssetProxy.sendTransactionAsync(
assetProxyContract,
isRegistered,
txData,
);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -1162,19 +1175,6 @@ export class AssetProxyOwnerContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(
assetProxyContract: string,
isRegistered: boolean,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).registerAssetProxy.callAsync(assetProxyContract, isRegistered, txData);
const txHash = await (this as any).registerAssetProxy.sendTransactionAsync(
assetProxyContract,
isRegistered,
txData,
);
return txHash;
},
};
/**
* Allows to add a new owner. Transaction has to be sent by wallet.
@@ -1261,6 +1261,11 @@ export class AssetProxyOwnerContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(owner: string, txData?: Partial<TxData> | undefined): Promise<string> {
await (this as any).addOwner.callAsync(owner, txData);
const txHash = await (this as any).addOwner.sendTransactionAsync(owner, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -1325,11 +1330,6 @@ export class AssetProxyOwnerContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(owner: string, txData?: Partial<TxData> | undefined): Promise<string> {
await (this as any).addOwner.callAsync(owner, txData);
const txHash = await (this as any).addOwner.sendTransactionAsync(owner, txData);
return txHash;
},
};
/**
* Returns the confirmation status of a transaction.
@@ -1496,6 +1496,14 @@ export class AssetProxyOwnerContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(
_secondsTimeLocked: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).changeTimeLock.callAsync(_secondsTimeLocked, txData);
const txHash = await (this as any).changeTimeLock.sendTransactionAsync(_secondsTimeLocked, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -1568,14 +1576,6 @@ export class AssetProxyOwnerContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(
_secondsTimeLocked: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).changeTimeLock.callAsync(_secondsTimeLocked, txData);
const txHash = await (this as any).changeTimeLock.sendTransactionAsync(_secondsTimeLocked, txData);
return txHash;
},
};
public isAssetProxyRegistered = {
/**
@@ -2177,6 +2177,14 @@ export class AssetProxyOwnerContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(
_required: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).changeRequirement.callAsync(_required, txData);
const txHash = await (this as any).changeRequirement.sendTransactionAsync(_required, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -2245,14 +2253,6 @@ export class AssetProxyOwnerContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(
_required: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).changeRequirement.callAsync(_required, txData);
const txHash = await (this as any).changeRequirement.sendTransactionAsync(_required, txData);
return txHash;
},
};
/**
* Allows an owner to confirm a transaction.
@@ -2339,6 +2339,14 @@ export class AssetProxyOwnerContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(
transactionId: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).confirmTransaction.callAsync(transactionId, txData);
const txHash = await (this as any).confirmTransaction.sendTransactionAsync(transactionId, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -2409,14 +2417,6 @@ export class AssetProxyOwnerContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(
transactionId: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).confirmTransaction.callAsync(transactionId, txData);
const txHash = await (this as any).confirmTransaction.sendTransactionAsync(transactionId, txData);
return txHash;
},
};
/**
* Allows an owner to submit and confirm a transaction.
@@ -2540,6 +2540,16 @@ export class AssetProxyOwnerContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(
destination: string,
value: BigNumber,
data: string,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).submitTransaction.callAsync(destination, value, data, txData);
const txHash = await (this as any).submitTransaction.sendTransactionAsync(destination, value, data, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -2627,16 +2637,6 @@ export class AssetProxyOwnerContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<BigNumber>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(
destination: string,
value: BigNumber,
data: string,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).submitTransaction.callAsync(destination, value, data, txData);
const txHash = await (this as any).submitTransaction.sendTransactionAsync(destination, value, data, txData);
return txHash;
},
};
public confirmationTimes = {
/**
@@ -2936,6 +2936,15 @@ export class AssetProxyOwnerContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(
owner: string,
newOwner: string,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).replaceOwner.callAsync(owner, newOwner, txData);
const txHash = await (this as any).replaceOwner.sendTransactionAsync(owner, newOwner, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -3015,15 +3024,6 @@ export class AssetProxyOwnerContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(
owner: string,
newOwner: string,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).replaceOwner.callAsync(owner, newOwner, txData);
const txHash = await (this as any).replaceOwner.sendTransactionAsync(owner, newOwner, txData);
return txHash;
},
};
/**
* Allows anyone to execute a confirmed transaction.
@@ -3110,6 +3110,14 @@ export class AssetProxyOwnerContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(
transactionId: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).executeTransaction.callAsync(transactionId, txData);
const txHash = await (this as any).executeTransaction.sendTransactionAsync(transactionId, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -3180,14 +3188,6 @@ export class AssetProxyOwnerContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(
transactionId: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).executeTransaction.callAsync(transactionId, txData);
const txHash = await (this as any).executeTransaction.sendTransactionAsync(transactionId, txData);
return txHash;
},
};
private readonly _subscriptionManager: SubscriptionManager<AssetProxyOwnerEventArgs, AssetProxyOwnerEvents>;
public static async deployFrom0xArtifactAsync(

View File

@@ -57,19 +57,9 @@ export class CoordinatorContract extends BaseContract {
}
const self = (this as any) as CoordinatorContract;
const encodedData = self._strictEncodeArguments('getSignerAddress(bytes32,bytes)', [hash, signature]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...callData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
);
callDataWithDefaults.from = callDataWithDefaults.from
? callDataWithDefaults.from.toLowerCase()
: callDataWithDefaults.from;
const encodedDataBytes = Buffer.from(encodedData.substr(2), 'hex');
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
const rawCallResult = await self.evmExecAsync(encodedDataBytes);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
const abiEncoder = self._lookupAbiEncoder('getSignerAddress(bytes32,bytes)');
// tslint:disable boolean-naming
@@ -444,6 +434,32 @@ export class CoordinatorContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(
transaction: { salt: BigNumber; signerAddress: string; data: string },
txOrigin: string,
transactionSignature: string,
approvalExpirationTimeSeconds: BigNumber[],
approvalSignatures: string[],
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).executeTransaction.callAsync(
transaction,
txOrigin,
transactionSignature,
approvalExpirationTimeSeconds,
approvalSignatures,
txData,
);
const txHash = await (this as any).executeTransaction.sendTransactionAsync(
transaction,
txOrigin,
transactionSignature,
approvalExpirationTimeSeconds,
approvalSignatures,
txData,
);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -568,32 +584,6 @@ export class CoordinatorContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(
transaction: { salt: BigNumber; signerAddress: string; data: string },
txOrigin: string,
transactionSignature: string,
approvalExpirationTimeSeconds: BigNumber[],
approvalSignatures: string[],
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).executeTransaction.callAsync(
transaction,
txOrigin,
transactionSignature,
approvalExpirationTimeSeconds,
approvalSignatures,
txData,
);
const txHash = await (this as any).executeTransaction.sendTransactionAsync(
transaction,
txOrigin,
transactionSignature,
approvalExpirationTimeSeconds,
approvalSignatures,
txData,
);
return txHash;
},
};
public EIP712_EXCHANGE_DOMAIN_HASH = {
/**
@@ -829,19 +819,9 @@ export class CoordinatorContract extends BaseContract {
}
const self = (this as any) as CoordinatorContract;
const encodedData = self._strictEncodeArguments('decodeOrdersFromFillData(bytes)', [data]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...callData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
);
callDataWithDefaults.from = callDataWithDefaults.from
? callDataWithDefaults.from.toLowerCase()
: callDataWithDefaults.from;
const encodedDataBytes = Buffer.from(encodedData.substr(2), 'hex');
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
const rawCallResult = await self.evmExecAsync(encodedDataBytes);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
const abiEncoder = self._lookupAbiEncoder('decodeOrdersFromFillData(bytes)');
// tslint:disable boolean-naming

View File

@@ -131,6 +131,14 @@ export class CoordinatorRegistryContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(
coordinatorEndpoint: string,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).setCoordinatorEndpoint.callAsync(coordinatorEndpoint, txData);
const txHash = await (this as any).setCoordinatorEndpoint.sendTransactionAsync(coordinatorEndpoint, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -201,14 +209,6 @@ export class CoordinatorRegistryContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(
coordinatorEndpoint: string,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).setCoordinatorEndpoint.callAsync(coordinatorEndpoint, txData);
const txHash = await (this as any).setCoordinatorEndpoint.sendTransactionAsync(coordinatorEndpoint, txData);
return txHash;
},
};
/**
* Gets the endpoint for a Coordinator.

View File

@@ -56,19 +56,9 @@ export class DevUtilsContract extends BaseContract {
}
const self = (this as any) as DevUtilsContract;
const encodedData = self._strictEncodeArguments('decodeERC721AssetData(bytes)', [assetData]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...callData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
);
callDataWithDefaults.from = callDataWithDefaults.from
? callDataWithDefaults.from.toLowerCase()
: callDataWithDefaults.from;
const encodedDataBytes = Buffer.from(encodedData.substr(2), 'hex');
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
const rawCallResult = await self.evmExecAsync(encodedDataBytes);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
const abiEncoder = self._lookupAbiEncoder('decodeERC721AssetData(bytes)');
// tslint:disable boolean-naming
@@ -457,19 +447,9 @@ export class DevUtilsContract extends BaseContract {
const encodedData = self._strictEncodeArguments('encodeERC20AssetData(address)', [
tokenAddress.toLowerCase(),
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...callData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
);
callDataWithDefaults.from = callDataWithDefaults.from
? callDataWithDefaults.from.toLowerCase()
: callDataWithDefaults.from;
const encodedDataBytes = Buffer.from(encodedData.substr(2), 'hex');
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
const rawCallResult = await self.evmExecAsync(encodedDataBytes);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
const abiEncoder = self._lookupAbiEncoder('encodeERC20AssetData(address)');
// tslint:disable boolean-naming
@@ -555,19 +535,9 @@ export class DevUtilsContract extends BaseContract {
}
const self = (this as any) as DevUtilsContract;
const encodedData = self._strictEncodeArguments('decodeZeroExTransactionData(bytes)', [transactionData]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...callData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
);
callDataWithDefaults.from = callDataWithDefaults.from
? callDataWithDefaults.from.toLowerCase()
: callDataWithDefaults.from;
const encodedDataBytes = Buffer.from(encodedData.substr(2), 'hex');
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
const rawCallResult = await self.evmExecAsync(encodedDataBytes);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
const abiEncoder = self._lookupAbiEncoder('decodeZeroExTransactionData(bytes)');
// tslint:disable boolean-naming
@@ -1041,19 +1011,9 @@ export class DevUtilsContract extends BaseContract {
}
const self = (this as any) as DevUtilsContract;
const encodedData = self._strictEncodeArguments('decodeERC20AssetData(bytes)', [assetData]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...callData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
);
callDataWithDefaults.from = callDataWithDefaults.from
? callDataWithDefaults.from.toLowerCase()
: callDataWithDefaults.from;
const encodedDataBytes = Buffer.from(encodedData.substr(2), 'hex');
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
const rawCallResult = await self.evmExecAsync(encodedDataBytes);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
const abiEncoder = self._lookupAbiEncoder('decodeERC20AssetData(bytes)');
// tslint:disable boolean-naming
@@ -1250,19 +1210,9 @@ export class DevUtilsContract extends BaseContract {
}
const self = (this as any) as DevUtilsContract;
const encodedData = self._strictEncodeArguments('decodeERC1155AssetData(bytes)', [assetData]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...callData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
);
callDataWithDefaults.from = callDataWithDefaults.from
? callDataWithDefaults.from.toLowerCase()
: callDataWithDefaults.from;
const encodedDataBytes = Buffer.from(encodedData.substr(2), 'hex');
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
const rawCallResult = await self.evmExecAsync(encodedDataBytes);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
const abiEncoder = self._lookupAbiEncoder('decodeERC1155AssetData(bytes)');
// tslint:disable boolean-naming
@@ -1474,19 +1424,9 @@ export class DevUtilsContract extends BaseContract {
tokenAddress.toLowerCase(),
tokenId,
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...callData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
);
callDataWithDefaults.from = callDataWithDefaults.from
? callDataWithDefaults.from.toLowerCase()
: callDataWithDefaults.from;
const encodedDataBytes = Buffer.from(encodedData.substr(2), 'hex');
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
const rawCallResult = await self.evmExecAsync(encodedDataBytes);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
const abiEncoder = self._lookupAbiEncoder('encodeERC721AssetData(address,uint256)');
// tslint:disable boolean-naming
@@ -1630,19 +1570,9 @@ export class DevUtilsContract extends BaseContract {
'encodeERC1155AssetData(address,uint256[],uint256[],bytes)',
[tokenAddress.toLowerCase(), tokenIds, tokenValues, callbackData],
);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...callData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
);
callDataWithDefaults.from = callDataWithDefaults.from
? callDataWithDefaults.from.toLowerCase()
: callDataWithDefaults.from;
const encodedDataBytes = Buffer.from(encodedData.substr(2), 'hex');
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
const rawCallResult = await self.evmExecAsync(encodedDataBytes);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
const abiEncoder = self._lookupAbiEncoder('encodeERC1155AssetData(address,uint256[],uint256[],bytes)');
// tslint:disable boolean-naming
@@ -1805,19 +1735,9 @@ export class DevUtilsContract extends BaseContract {
}
const self = (this as any) as DevUtilsContract;
const encodedData = self._strictEncodeArguments('decodeMultiAssetData(bytes)', [assetData]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...callData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
);
callDataWithDefaults.from = callDataWithDefaults.from
? callDataWithDefaults.from.toLowerCase()
: callDataWithDefaults.from;
const encodedDataBytes = Buffer.from(encodedData.substr(2), 'hex');
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
const rawCallResult = await self.evmExecAsync(encodedDataBytes);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
const abiEncoder = self._lookupAbiEncoder('decodeMultiAssetData(bytes)');
// tslint:disable boolean-naming
@@ -2062,19 +1982,9 @@ export class DevUtilsContract extends BaseContract {
amounts,
nestedAssetData,
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...callData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
);
callDataWithDefaults.from = callDataWithDefaults.from
? callDataWithDefaults.from.toLowerCase()
: callDataWithDefaults.from;
const encodedDataBytes = Buffer.from(encodedData.substr(2), 'hex');
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
const rawCallResult = await self.evmExecAsync(encodedDataBytes);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
const abiEncoder = self._lookupAbiEncoder('encodeMultiAssetData(uint256[],bytes[])');
// tslint:disable boolean-naming

View File

@@ -222,6 +222,15 @@ export class DummyERC20TokenContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(
_spender: string,
_value: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).approve.callAsync(_spender, _value, txData);
const txHash = await (this as any).approve.sendTransactionAsync(_spender, _value, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -302,15 +311,6 @@ export class DummyERC20TokenContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<boolean>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(
_spender: string,
_value: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).approve.callAsync(_spender, _value, txData);
const txHash = await (this as any).approve.sendTransactionAsync(_spender, _value, txData);
return txHash;
},
};
/**
* Query total supply of token
@@ -500,6 +500,16 @@ export class DummyERC20TokenContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(
_from: string,
_to: string,
_value: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).transferFrom.callAsync(_from, _to, _value, txData);
const txHash = await (this as any).transferFrom.sendTransactionAsync(_from, _to, _value, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -587,16 +597,6 @@ export class DummyERC20TokenContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<boolean>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(
_from: string,
_to: string,
_value: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).transferFrom.callAsync(_from, _to, _value, txData);
const txHash = await (this as any).transferFrom.sendTransactionAsync(_from, _to, _value, txData);
return txHash;
},
};
public decimals = {
/**
@@ -943,6 +943,14 @@ export class DummyERC20TokenContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(
_value: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).mint.callAsync(_value, txData);
const txHash = await (this as any).mint.sendTransactionAsync(_value, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -1007,14 +1015,6 @@ export class DummyERC20TokenContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(
_value: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).mint.callAsync(_value, txData);
const txHash = await (this as any).mint.sendTransactionAsync(_value, txData);
return txHash;
},
};
/**
* send `value` token to `to` from `msg.sender`
@@ -1112,6 +1112,15 @@ export class DummyERC20TokenContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(
_to: string,
_value: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).transfer.callAsync(_to, _value, txData);
const txHash = await (this as any).transfer.sendTransactionAsync(_to, _value, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -1189,15 +1198,6 @@ export class DummyERC20TokenContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<boolean>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(
_to: string,
_value: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).transfer.callAsync(_to, _value, txData);
const txHash = await (this as any).transfer.sendTransactionAsync(_to, _value, txData);
return txHash;
},
};
public allowance = {
/**
@@ -1387,6 +1387,15 @@ export class DummyERC20TokenContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(
_target: string,
_value: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).setBalance.callAsync(_target, _value, txData);
const txHash = await (this as any).setBalance.sendTransactionAsync(_target, _value, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -1466,15 +1475,6 @@ export class DummyERC20TokenContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(
_target: string,
_value: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).setBalance.callAsync(_target, _value, txData);
const txHash = await (this as any).setBalance.sendTransactionAsync(_target, _value, txData);
return txHash;
},
};
public transferOwnership = {
/**
@@ -1555,6 +1555,11 @@ export class DummyERC20TokenContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(newOwner: string, txData?: Partial<TxData> | undefined): Promise<string> {
await (this as any).transferOwnership.callAsync(newOwner, txData);
const txHash = await (this as any).transferOwnership.sendTransactionAsync(newOwner, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -1619,11 +1624,6 @@ export class DummyERC20TokenContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(newOwner: string, txData?: Partial<TxData> | undefined): Promise<string> {
await (this as any).transferOwnership.callAsync(newOwner, txData);
const txHash = await (this as any).transferOwnership.sendTransactionAsync(newOwner, txData);
return txHash;
},
};
public MAX_MINT_AMOUNT = {
/**

View File

@@ -308,6 +308,15 @@ export class DummyERC721TokenContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(
_approved: string,
_tokenId: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).approve.callAsync(_approved, _tokenId, txData);
const txHash = await (this as any).approve.sendTransactionAsync(_approved, _tokenId, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -387,15 +396,6 @@ export class DummyERC721TokenContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(
_approved: string,
_tokenId: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).approve.callAsync(_approved, _tokenId, txData);
const txHash = await (this as any).approve.sendTransactionAsync(_approved, _tokenId, txData);
return txHash;
},
};
/**
* Throws unless `msg.sender` is the current owner, an authorized
@@ -522,6 +522,16 @@ export class DummyERC721TokenContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(
_from: string,
_to: string,
_tokenId: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).transferFrom.callAsync(_from, _to, _tokenId, txData);
const txHash = await (this as any).transferFrom.sendTransactionAsync(_from, _to, _tokenId, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -608,16 +618,6 @@ export class DummyERC721TokenContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(
_from: string,
_to: string,
_tokenId: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).transferFrom.callAsync(_from, _to, _tokenId, txData);
const txHash = await (this as any).transferFrom.sendTransactionAsync(_from, _to, _tokenId, txData);
return txHash;
},
};
/**
* Function to mint a new token
@@ -720,6 +720,15 @@ export class DummyERC721TokenContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(
_to: string,
_tokenId: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).mint.callAsync(_to, _tokenId, txData);
const txHash = await (this as any).mint.sendTransactionAsync(_to, _tokenId, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -796,15 +805,6 @@ export class DummyERC721TokenContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(
_to: string,
_tokenId: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).mint.callAsync(_to, _tokenId, txData);
const txHash = await (this as any).mint.sendTransactionAsync(_to, _tokenId, txData);
return txHash;
},
};
/**
* This works identically to the other function with an extra data parameter,
@@ -929,6 +929,16 @@ export class DummyERC721TokenContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(
_from: string,
_to: string,
_tokenId: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).safeTransferFrom1.callAsync(_from, _to, _tokenId, txData);
const txHash = await (this as any).safeTransferFrom1.sendTransactionAsync(_from, _to, _tokenId, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -1015,16 +1025,6 @@ export class DummyERC721TokenContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(
_from: string,
_to: string,
_tokenId: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).safeTransferFrom1.callAsync(_from, _to, _tokenId, txData);
const txHash = await (this as any).safeTransferFrom1.sendTransactionAsync(_from, _to, _tokenId, txData);
return txHash;
},
};
/**
* NFTs assigned to zero address are considered invalid, and queries
@@ -1401,6 +1401,15 @@ export class DummyERC721TokenContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(
_owner: string,
_tokenId: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).burn.callAsync(_owner, _tokenId, txData);
const txHash = await (this as any).burn.sendTransactionAsync(_owner, _tokenId, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -1477,15 +1486,6 @@ export class DummyERC721TokenContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(
_owner: string,
_tokenId: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).burn.callAsync(_owner, _tokenId, txData);
const txHash = await (this as any).burn.sendTransactionAsync(_owner, _tokenId, txData);
return txHash;
},
};
/**
* Emits the ApprovalForAll event. The contract MUST allow
@@ -1598,6 +1598,15 @@ export class DummyERC721TokenContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(
_operator: string,
_approved: boolean,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).setApprovalForAll.callAsync(_operator, _approved, txData);
const txHash = await (this as any).setApprovalForAll.sendTransactionAsync(_operator, _approved, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -1677,15 +1686,6 @@ export class DummyERC721TokenContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(
_operator: string,
_approved: boolean,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).setApprovalForAll.callAsync(_operator, _approved, txData);
const txHash = await (this as any).setApprovalForAll.sendTransactionAsync(_operator, _approved, txData);
return txHash;
},
};
/**
* Throws unless `msg.sender` is the current owner, an authorized
@@ -1833,6 +1833,23 @@ export class DummyERC721TokenContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(
_from: string,
_to: string,
_tokenId: BigNumber,
_data: string,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).safeTransferFrom2.callAsync(_from, _to, _tokenId, _data, txData);
const txHash = await (this as any).safeTransferFrom2.sendTransactionAsync(
_from,
_to,
_tokenId,
_data,
txData,
);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -1924,23 +1941,6 @@ export class DummyERC721TokenContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(
_from: string,
_to: string,
_tokenId: BigNumber,
_data: string,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).safeTransferFrom2.callAsync(_from, _to, _tokenId, _data, txData);
const txHash = await (this as any).safeTransferFrom2.sendTransactionAsync(
_from,
_to,
_tokenId,
_data,
txData,
);
return txHash;
},
};
public isApprovedForAll = {
/**
@@ -2103,6 +2103,11 @@ export class DummyERC721TokenContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(newOwner: string, txData?: Partial<TxData> | undefined): Promise<string> {
await (this as any).transferOwnership.callAsync(newOwner, txData);
const txHash = await (this as any).transferOwnership.sendTransactionAsync(newOwner, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -2167,11 +2172,6 @@ export class DummyERC721TokenContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(newOwner: string, txData?: Partial<TxData> | undefined): Promise<string> {
await (this as any).transferOwnership.callAsync(newOwner, txData);
const txHash = await (this as any).transferOwnership.sendTransactionAsync(newOwner, txData);
return txHash;
},
};
private readonly _subscriptionManager: SubscriptionManager<DummyERC721TokenEventArgs, DummyERC721TokenEvents>;
public static async deployFrom0xArtifactAsync(

View File

@@ -161,6 +161,27 @@ export class DutchAuctionContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(
order: {
makerAddress: string;
takerAddress: string;
feeRecipientAddress: string;
senderAddress: string;
makerAssetAmount: BigNumber;
takerAssetAmount: BigNumber;
makerFee: BigNumber;
takerFee: BigNumber;
expirationTimeSeconds: BigNumber;
salt: BigNumber;
makerAssetData: string;
takerAssetData: string;
},
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).getAuctionDetails.callAsync(order, txData);
const txHash = await (this as any).getAuctionDetails.sendTransactionAsync(order, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -312,27 +333,6 @@ export class DutchAuctionContract extends BaseContract {
}>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(
order: {
makerAddress: string;
takerAddress: string;
feeRecipientAddress: string;
senderAddress: string;
makerAssetAmount: BigNumber;
takerAssetAmount: BigNumber;
makerFee: BigNumber;
takerFee: BigNumber;
expirationTimeSeconds: BigNumber;
salt: BigNumber;
makerAssetData: string;
takerAssetData: string;
},
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).getAuctionDetails.callAsync(order, txData);
const txHash = await (this as any).getAuctionDetails.sendTransactionAsync(order, txData);
return txHash;
},
};
/**
* Matches the buy and sell orders at an amount given the following: the current block time, the auction
@@ -556,6 +556,49 @@ export class DutchAuctionContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(
buyOrder: {
makerAddress: string;
takerAddress: string;
feeRecipientAddress: string;
senderAddress: string;
makerAssetAmount: BigNumber;
takerAssetAmount: BigNumber;
makerFee: BigNumber;
takerFee: BigNumber;
expirationTimeSeconds: BigNumber;
salt: BigNumber;
makerAssetData: string;
takerAssetData: string;
},
sellOrder: {
makerAddress: string;
takerAddress: string;
feeRecipientAddress: string;
senderAddress: string;
makerAssetAmount: BigNumber;
takerAssetAmount: BigNumber;
makerFee: BigNumber;
takerFee: BigNumber;
expirationTimeSeconds: BigNumber;
salt: BigNumber;
makerAssetData: string;
takerAssetData: string;
},
buySignature: string,
sellSignature: string,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).matchOrders.callAsync(buyOrder, sellOrder, buySignature, sellSignature, txData);
const txHash = await (this as any).matchOrders.sendTransactionAsync(
buyOrder,
sellOrder,
buySignature,
sellSignature,
txData,
);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -797,49 +840,6 @@ export class DutchAuctionContract extends BaseContract {
}>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(
buyOrder: {
makerAddress: string;
takerAddress: string;
feeRecipientAddress: string;
senderAddress: string;
makerAssetAmount: BigNumber;
takerAssetAmount: BigNumber;
makerFee: BigNumber;
takerFee: BigNumber;
expirationTimeSeconds: BigNumber;
salt: BigNumber;
makerAssetData: string;
takerAssetData: string;
},
sellOrder: {
makerAddress: string;
takerAddress: string;
feeRecipientAddress: string;
senderAddress: string;
makerAssetAmount: BigNumber;
takerAssetAmount: BigNumber;
makerFee: BigNumber;
takerFee: BigNumber;
expirationTimeSeconds: BigNumber;
salt: BigNumber;
makerAssetData: string;
takerAssetData: string;
},
buySignature: string,
sellSignature: string,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).matchOrders.callAsync(buyOrder, sellOrder, buySignature, sellSignature, txData);
const txHash = await (this as any).matchOrders.sendTransactionAsync(
buyOrder,
sellOrder,
buySignature,
sellSignature,
txData,
);
return txHash;
},
};
public static async deployFrom0xArtifactAsync(
artifact: ContractArtifact | SimpleContractArtifact,

View File

@@ -139,6 +139,11 @@ export class ERC1155ProxyContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(target: string, txData?: Partial<TxData> | undefined): Promise<string> {
await (this as any).addAuthorizedAddress.callAsync(target, txData);
const txHash = await (this as any).addAuthorizedAddress.sendTransactionAsync(target, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -205,11 +210,6 @@ export class ERC1155ProxyContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(target: string, txData?: Partial<TxData> | undefined): Promise<string> {
await (this as any).addAuthorizedAddress.callAsync(target, txData);
const txHash = await (this as any).addAuthorizedAddress.sendTransactionAsync(target, txData);
return txHash;
},
};
public authorities = {
/**
@@ -364,6 +364,11 @@ export class ERC1155ProxyContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(target: string, txData?: Partial<TxData> | undefined): Promise<string> {
await (this as any).removeAuthorizedAddress.callAsync(target, txData);
const txHash = await (this as any).removeAuthorizedAddress.sendTransactionAsync(target, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -430,11 +435,6 @@ export class ERC1155ProxyContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(target: string, txData?: Partial<TxData> | undefined): Promise<string> {
await (this as any).removeAuthorizedAddress.callAsync(target, txData);
const txHash = await (this as any).removeAuthorizedAddress.sendTransactionAsync(target, txData);
return txHash;
},
};
public owner = {
/**
@@ -608,6 +608,19 @@ export class ERC1155ProxyContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(
target: string,
index: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).removeAuthorizedAddressAtIndex.callAsync(target, index, txData);
const txHash = await (this as any).removeAuthorizedAddressAtIndex.sendTransactionAsync(
target,
index,
txData,
);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -687,19 +700,6 @@ export class ERC1155ProxyContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(
target: string,
index: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).removeAuthorizedAddressAtIndex.callAsync(target, index, txData);
const txHash = await (this as any).removeAuthorizedAddressAtIndex.sendTransactionAsync(
target,
index,
txData,
);
return txHash;
},
};
/**
* Transfers batch of ERC1155 assets. Either succeeds or throws.
@@ -841,6 +841,17 @@ export class ERC1155ProxyContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(
assetData: string,
from: string,
to: string,
amount: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).transferFrom.callAsync(assetData, from, to, amount, txData);
const txHash = await (this as any).transferFrom.sendTransactionAsync(assetData, from, to, amount, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -936,17 +947,6 @@ export class ERC1155ProxyContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(
assetData: string,
from: string,
to: string,
amount: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).transferFrom.callAsync(assetData, from, to, amount, txData);
const txHash = await (this as any).transferFrom.sendTransactionAsync(assetData, from, to, amount, txData);
return txHash;
},
};
/**
* Gets the proxy id associated with the proxy address.
@@ -969,19 +969,9 @@ export class ERC1155ProxyContract extends BaseContract {
}
const self = (this as any) as ERC1155ProxyContract;
const encodedData = self._strictEncodeArguments('getProxyId()', []);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...callData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
);
callDataWithDefaults.from = callDataWithDefaults.from
? callDataWithDefaults.from.toLowerCase()
: callDataWithDefaults.from;
const encodedDataBytes = Buffer.from(encodedData.substr(2), 'hex');
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
const rawCallResult = await self.evmExecAsync(encodedDataBytes);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
const abiEncoder = self._lookupAbiEncoder('getProxyId()');
// tslint:disable boolean-naming
@@ -1229,6 +1219,11 @@ export class ERC1155ProxyContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(newOwner: string, txData?: Partial<TxData> | undefined): Promise<string> {
await (this as any).transferOwnership.callAsync(newOwner, txData);
const txHash = await (this as any).transferOwnership.sendTransactionAsync(newOwner, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -1293,11 +1288,6 @@ export class ERC1155ProxyContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(newOwner: string, txData?: Partial<TxData> | undefined): Promise<string> {
await (this as any).transferOwnership.callAsync(newOwner, txData);
const txHash = await (this as any).transferOwnership.sendTransactionAsync(newOwner, txData);
return txHash;
},
};
private readonly _subscriptionManager: SubscriptionManager<ERC1155ProxyEventArgs, ERC1155ProxyEvents>;
public static async deployFrom0xArtifactAsync(

View File

@@ -139,6 +139,11 @@ export class ERC20ProxyContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(target: string, txData?: Partial<TxData> | undefined): Promise<string> {
await (this as any).addAuthorizedAddress.callAsync(target, txData);
const txHash = await (this as any).addAuthorizedAddress.sendTransactionAsync(target, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -205,11 +210,6 @@ export class ERC20ProxyContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(target: string, txData?: Partial<TxData> | undefined): Promise<string> {
await (this as any).addAuthorizedAddress.callAsync(target, txData);
const txHash = await (this as any).addAuthorizedAddress.sendTransactionAsync(target, txData);
return txHash;
},
};
public authorities = {
/**
@@ -364,6 +364,11 @@ export class ERC20ProxyContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(target: string, txData?: Partial<TxData> | undefined): Promise<string> {
await (this as any).removeAuthorizedAddress.callAsync(target, txData);
const txHash = await (this as any).removeAuthorizedAddress.sendTransactionAsync(target, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -430,11 +435,6 @@ export class ERC20ProxyContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(target: string, txData?: Partial<TxData> | undefined): Promise<string> {
await (this as any).removeAuthorizedAddress.callAsync(target, txData);
const txHash = await (this as any).removeAuthorizedAddress.sendTransactionAsync(target, txData);
return txHash;
},
};
public owner = {
/**
@@ -608,6 +608,19 @@ export class ERC20ProxyContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(
target: string,
index: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).removeAuthorizedAddressAtIndex.callAsync(target, index, txData);
const txHash = await (this as any).removeAuthorizedAddressAtIndex.sendTransactionAsync(
target,
index,
txData,
);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -687,19 +700,6 @@ export class ERC20ProxyContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(
target: string,
index: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).removeAuthorizedAddressAtIndex.callAsync(target, index, txData);
const txHash = await (this as any).removeAuthorizedAddressAtIndex.sendTransactionAsync(
target,
index,
txData,
);
return txHash;
},
};
/**
* Gets the proxy id associated with the proxy address.
@@ -722,19 +722,9 @@ export class ERC20ProxyContract extends BaseContract {
}
const self = (this as any) as ERC20ProxyContract;
const encodedData = self._strictEncodeArguments('getProxyId()', []);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...callData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
);
callDataWithDefaults.from = callDataWithDefaults.from
? callDataWithDefaults.from.toLowerCase()
: callDataWithDefaults.from;
const encodedDataBytes = Buffer.from(encodedData.substr(2), 'hex');
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
const rawCallResult = await self.evmExecAsync(encodedDataBytes);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
const abiEncoder = self._lookupAbiEncoder('getProxyId()');
// tslint:disable boolean-naming
@@ -982,6 +972,11 @@ export class ERC20ProxyContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(newOwner: string, txData?: Partial<TxData> | undefined): Promise<string> {
await (this as any).transferOwnership.callAsync(newOwner, txData);
const txHash = await (this as any).transferOwnership.sendTransactionAsync(newOwner, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -1046,11 +1041,6 @@ export class ERC20ProxyContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(newOwner: string, txData?: Partial<TxData> | undefined): Promise<string> {
await (this as any).transferOwnership.callAsync(newOwner, txData);
const txHash = await (this as any).transferOwnership.sendTransactionAsync(newOwner, txData);
return txHash;
},
};
private readonly _subscriptionManager: SubscriptionManager<ERC20ProxyEventArgs, ERC20ProxyEvents>;
public static async deployFrom0xArtifactAsync(

View File

@@ -160,6 +160,15 @@ export class ERC20TokenContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(
_spender: string,
_value: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).approve.callAsync(_spender, _value, txData);
const txHash = await (this as any).approve.sendTransactionAsync(_spender, _value, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -240,15 +249,6 @@ export class ERC20TokenContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<boolean>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(
_spender: string,
_value: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).approve.callAsync(_spender, _value, txData);
const txHash = await (this as any).approve.sendTransactionAsync(_spender, _value, txData);
return txHash;
},
};
/**
* Query total supply of token
@@ -438,6 +438,16 @@ export class ERC20TokenContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(
_from: string,
_to: string,
_value: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).transferFrom.callAsync(_from, _to, _value, txData);
const txHash = await (this as any).transferFrom.sendTransactionAsync(_from, _to, _value, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -525,16 +535,6 @@ export class ERC20TokenContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<boolean>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(
_from: string,
_to: string,
_value: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).transferFrom.callAsync(_from, _to, _value, txData);
const txHash = await (this as any).transferFrom.sendTransactionAsync(_from, _to, _value, txData);
return txHash;
},
};
/**
* Query the balance of owner
@@ -706,6 +706,15 @@ export class ERC20TokenContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(
_to: string,
_value: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).transfer.callAsync(_to, _value, txData);
const txHash = await (this as any).transfer.sendTransactionAsync(_to, _value, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -783,15 +792,6 @@ export class ERC20TokenContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<boolean>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(
_to: string,
_value: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).transfer.callAsync(_to, _value, txData);
const txHash = await (this as any).transfer.sendTransactionAsync(_to, _value, txData);
return txHash;
},
};
public allowance = {
/**

View File

@@ -139,6 +139,11 @@ export class ERC721ProxyContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(target: string, txData?: Partial<TxData> | undefined): Promise<string> {
await (this as any).addAuthorizedAddress.callAsync(target, txData);
const txHash = await (this as any).addAuthorizedAddress.sendTransactionAsync(target, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -205,11 +210,6 @@ export class ERC721ProxyContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(target: string, txData?: Partial<TxData> | undefined): Promise<string> {
await (this as any).addAuthorizedAddress.callAsync(target, txData);
const txHash = await (this as any).addAuthorizedAddress.sendTransactionAsync(target, txData);
return txHash;
},
};
public authorities = {
/**
@@ -364,6 +364,11 @@ export class ERC721ProxyContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(target: string, txData?: Partial<TxData> | undefined): Promise<string> {
await (this as any).removeAuthorizedAddress.callAsync(target, txData);
const txHash = await (this as any).removeAuthorizedAddress.sendTransactionAsync(target, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -430,11 +435,6 @@ export class ERC721ProxyContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(target: string, txData?: Partial<TxData> | undefined): Promise<string> {
await (this as any).removeAuthorizedAddress.callAsync(target, txData);
const txHash = await (this as any).removeAuthorizedAddress.sendTransactionAsync(target, txData);
return txHash;
},
};
public owner = {
/**
@@ -608,6 +608,19 @@ export class ERC721ProxyContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(
target: string,
index: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).removeAuthorizedAddressAtIndex.callAsync(target, index, txData);
const txHash = await (this as any).removeAuthorizedAddressAtIndex.sendTransactionAsync(
target,
index,
txData,
);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -687,19 +700,6 @@ export class ERC721ProxyContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(
target: string,
index: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).removeAuthorizedAddressAtIndex.callAsync(target, index, txData);
const txHash = await (this as any).removeAuthorizedAddressAtIndex.sendTransactionAsync(
target,
index,
txData,
);
return txHash;
},
};
/**
* Gets the proxy id associated with the proxy address.
@@ -722,19 +722,9 @@ export class ERC721ProxyContract extends BaseContract {
}
const self = (this as any) as ERC721ProxyContract;
const encodedData = self._strictEncodeArguments('getProxyId()', []);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...callData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
);
callDataWithDefaults.from = callDataWithDefaults.from
? callDataWithDefaults.from.toLowerCase()
: callDataWithDefaults.from;
const encodedDataBytes = Buffer.from(encodedData.substr(2), 'hex');
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
const rawCallResult = await self.evmExecAsync(encodedDataBytes);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
const abiEncoder = self._lookupAbiEncoder('getProxyId()');
// tslint:disable boolean-naming
@@ -982,6 +972,11 @@ export class ERC721ProxyContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(newOwner: string, txData?: Partial<TxData> | undefined): Promise<string> {
await (this as any).transferOwnership.callAsync(newOwner, txData);
const txHash = await (this as any).transferOwnership.sendTransactionAsync(newOwner, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -1046,11 +1041,6 @@ export class ERC721ProxyContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(newOwner: string, txData?: Partial<TxData> | undefined): Promise<string> {
await (this as any).transferOwnership.callAsync(newOwner, txData);
const txHash = await (this as any).transferOwnership.sendTransactionAsync(newOwner, txData);
return txHash;
},
};
private readonly _subscriptionManager: SubscriptionManager<ERC721ProxyEventArgs, ERC721ProxyEvents>;
public static async deployFrom0xArtifactAsync(

View File

@@ -246,6 +246,15 @@ export class ERC721TokenContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(
_approved: string,
_tokenId: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).approve.callAsync(_approved, _tokenId, txData);
const txHash = await (this as any).approve.sendTransactionAsync(_approved, _tokenId, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -325,15 +334,6 @@ export class ERC721TokenContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(
_approved: string,
_tokenId: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).approve.callAsync(_approved, _tokenId, txData);
const txHash = await (this as any).approve.sendTransactionAsync(_approved, _tokenId, txData);
return txHash;
},
};
/**
* Throws unless `msg.sender` is the current owner, an authorized
@@ -460,6 +460,16 @@ export class ERC721TokenContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(
_from: string,
_to: string,
_tokenId: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).transferFrom.callAsync(_from, _to, _tokenId, txData);
const txHash = await (this as any).transferFrom.sendTransactionAsync(_from, _to, _tokenId, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -546,16 +556,6 @@ export class ERC721TokenContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(
_from: string,
_to: string,
_tokenId: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).transferFrom.callAsync(_from, _to, _tokenId, txData);
const txHash = await (this as any).transferFrom.sendTransactionAsync(_from, _to, _tokenId, txData);
return txHash;
},
};
/**
* This works identically to the other function with an extra data parameter,
@@ -680,6 +680,16 @@ export class ERC721TokenContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(
_from: string,
_to: string,
_tokenId: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).safeTransferFrom1.callAsync(_from, _to, _tokenId, txData);
const txHash = await (this as any).safeTransferFrom1.sendTransactionAsync(_from, _to, _tokenId, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -766,16 +776,6 @@ export class ERC721TokenContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(
_from: string,
_to: string,
_tokenId: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).safeTransferFrom1.callAsync(_from, _to, _tokenId, txData);
const txHash = await (this as any).safeTransferFrom1.sendTransactionAsync(_from, _to, _tokenId, txData);
return txHash;
},
};
/**
* NFTs assigned to zero address are considered invalid, and queries
@@ -1038,6 +1038,15 @@ export class ERC721TokenContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(
_operator: string,
_approved: boolean,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).setApprovalForAll.callAsync(_operator, _approved, txData);
const txHash = await (this as any).setApprovalForAll.sendTransactionAsync(_operator, _approved, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -1117,15 +1126,6 @@ export class ERC721TokenContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(
_operator: string,
_approved: boolean,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).setApprovalForAll.callAsync(_operator, _approved, txData);
const txHash = await (this as any).setApprovalForAll.sendTransactionAsync(_operator, _approved, txData);
return txHash;
},
};
/**
* Throws unless `msg.sender` is the current owner, an authorized
@@ -1273,6 +1273,23 @@ export class ERC721TokenContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(
_from: string,
_to: string,
_tokenId: BigNumber,
_data: string,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).safeTransferFrom2.callAsync(_from, _to, _tokenId, _data, txData);
const txHash = await (this as any).safeTransferFrom2.sendTransactionAsync(
_from,
_to,
_tokenId,
_data,
txData,
);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -1364,23 +1381,6 @@ export class ERC721TokenContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(
_from: string,
_to: string,
_tokenId: BigNumber,
_data: string,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).safeTransferFrom2.callAsync(_from, _to, _tokenId, _data, txData);
const txHash = await (this as any).safeTransferFrom2.sendTransactionAsync(
_from,
_to,
_tokenId,
_data,
txData,
);
return txHash;
},
};
public isApprovedForAll = {
/**

File diff suppressed because it is too large Load Diff

View File

@@ -302,6 +302,64 @@ export class ForwarderContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(
orders: Array<{
makerAddress: string;
takerAddress: string;
feeRecipientAddress: string;
senderAddress: string;
makerAssetAmount: BigNumber;
takerAssetAmount: BigNumber;
makerFee: BigNumber;
takerFee: BigNumber;
expirationTimeSeconds: BigNumber;
salt: BigNumber;
makerAssetData: string;
takerAssetData: string;
}>,
makerAssetFillAmount: BigNumber,
signatures: string[],
feeOrders: Array<{
makerAddress: string;
takerAddress: string;
feeRecipientAddress: string;
senderAddress: string;
makerAssetAmount: BigNumber;
takerAssetAmount: BigNumber;
makerFee: BigNumber;
takerFee: BigNumber;
expirationTimeSeconds: BigNumber;
salt: BigNumber;
makerAssetData: string;
takerAssetData: string;
}>,
feeSignatures: string[],
feePercentage: BigNumber,
feeRecipient: string,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).marketBuyOrdersWithEth.callAsync(
orders,
makerAssetFillAmount,
signatures,
feeOrders,
feeSignatures,
feePercentage,
feeRecipient,
txData,
);
const txHash = await (this as any).marketBuyOrdersWithEth.sendTransactionAsync(
orders,
makerAssetFillAmount,
signatures,
feeOrders,
feeSignatures,
feePercentage,
feeRecipient,
txData,
);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -585,64 +643,6 @@ export class ForwarderContract extends BaseContract {
>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(
orders: Array<{
makerAddress: string;
takerAddress: string;
feeRecipientAddress: string;
senderAddress: string;
makerAssetAmount: BigNumber;
takerAssetAmount: BigNumber;
makerFee: BigNumber;
takerFee: BigNumber;
expirationTimeSeconds: BigNumber;
salt: BigNumber;
makerAssetData: string;
takerAssetData: string;
}>,
makerAssetFillAmount: BigNumber,
signatures: string[],
feeOrders: Array<{
makerAddress: string;
takerAddress: string;
feeRecipientAddress: string;
senderAddress: string;
makerAssetAmount: BigNumber;
takerAssetAmount: BigNumber;
makerFee: BigNumber;
takerFee: BigNumber;
expirationTimeSeconds: BigNumber;
salt: BigNumber;
makerAssetData: string;
takerAssetData: string;
}>,
feeSignatures: string[],
feePercentage: BigNumber,
feeRecipient: string,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).marketBuyOrdersWithEth.callAsync(
orders,
makerAssetFillAmount,
signatures,
feeOrders,
feeSignatures,
feePercentage,
feeRecipient,
txData,
);
const txHash = await (this as any).marketBuyOrdersWithEth.sendTransactionAsync(
orders,
makerAssetFillAmount,
signatures,
feeOrders,
feeSignatures,
feePercentage,
feeRecipient,
txData,
);
return txHash;
},
};
/**
* Withdraws assets from this contract. The contract requires a ZRX balance in order to
@@ -746,6 +746,15 @@ export class ForwarderContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(
assetData: string,
amount: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).withdrawAsset.callAsync(assetData, amount, txData);
const txHash = await (this as any).withdrawAsset.sendTransactionAsync(assetData, amount, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -822,15 +831,6 @@ export class ForwarderContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(
assetData: string,
amount: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).withdrawAsset.callAsync(assetData, amount, txData);
const txHash = await (this as any).withdrawAsset.sendTransactionAsync(assetData, amount, txData);
return txHash;
},
};
public owner = {
/**
@@ -1142,6 +1142,61 @@ export class ForwarderContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(
orders: Array<{
makerAddress: string;
takerAddress: string;
feeRecipientAddress: string;
senderAddress: string;
makerAssetAmount: BigNumber;
takerAssetAmount: BigNumber;
makerFee: BigNumber;
takerFee: BigNumber;
expirationTimeSeconds: BigNumber;
salt: BigNumber;
makerAssetData: string;
takerAssetData: string;
}>,
signatures: string[],
feeOrders: Array<{
makerAddress: string;
takerAddress: string;
feeRecipientAddress: string;
senderAddress: string;
makerAssetAmount: BigNumber;
takerAssetAmount: BigNumber;
makerFee: BigNumber;
takerFee: BigNumber;
expirationTimeSeconds: BigNumber;
salt: BigNumber;
makerAssetData: string;
takerAssetData: string;
}>,
feeSignatures: string[],
feePercentage: BigNumber,
feeRecipient: string,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).marketSellOrdersWithEth.callAsync(
orders,
signatures,
feeOrders,
feeSignatures,
feePercentage,
feeRecipient,
txData,
);
const txHash = await (this as any).marketSellOrdersWithEth.sendTransactionAsync(
orders,
signatures,
feeOrders,
feeSignatures,
feePercentage,
feeRecipient,
txData,
);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -1403,61 +1458,6 @@ export class ForwarderContract extends BaseContract {
>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(
orders: Array<{
makerAddress: string;
takerAddress: string;
feeRecipientAddress: string;
senderAddress: string;
makerAssetAmount: BigNumber;
takerAssetAmount: BigNumber;
makerFee: BigNumber;
takerFee: BigNumber;
expirationTimeSeconds: BigNumber;
salt: BigNumber;
makerAssetData: string;
takerAssetData: string;
}>,
signatures: string[],
feeOrders: Array<{
makerAddress: string;
takerAddress: string;
feeRecipientAddress: string;
senderAddress: string;
makerAssetAmount: BigNumber;
takerAssetAmount: BigNumber;
makerFee: BigNumber;
takerFee: BigNumber;
expirationTimeSeconds: BigNumber;
salt: BigNumber;
makerAssetData: string;
takerAssetData: string;
}>,
feeSignatures: string[],
feePercentage: BigNumber,
feeRecipient: string,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).marketSellOrdersWithEth.callAsync(
orders,
signatures,
feeOrders,
feeSignatures,
feePercentage,
feeRecipient,
txData,
);
const txHash = await (this as any).marketSellOrdersWithEth.sendTransactionAsync(
orders,
signatures,
feeOrders,
feeSignatures,
feePercentage,
feeRecipient,
txData,
);
return txHash;
},
};
public transferOwnership = {
/**
@@ -1538,6 +1538,11 @@ export class ForwarderContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(newOwner: string, txData?: Partial<TxData> | undefined): Promise<string> {
await (this as any).transferOwnership.callAsync(newOwner, txData);
const txHash = await (this as any).transferOwnership.sendTransactionAsync(newOwner, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -1602,11 +1607,6 @@ export class ForwarderContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(newOwner: string, txData?: Partial<TxData> | undefined): Promise<string> {
await (this as any).transferOwnership.callAsync(newOwner, txData);
const txHash = await (this as any).transferOwnership.sendTransactionAsync(newOwner, txData);
return txHash;
},
};
public static async deployFrom0xArtifactAsync(
artifact: ContractArtifact | SimpleContractArtifact,

View File

@@ -113,6 +113,11 @@ export class IAssetProxyContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(target: string, txData?: Partial<TxData> | undefined): Promise<string> {
await (this as any).addAuthorizedAddress.callAsync(target, txData);
const txHash = await (this as any).addAuthorizedAddress.sendTransactionAsync(target, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -179,11 +184,6 @@ export class IAssetProxyContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(target: string, txData?: Partial<TxData> | undefined): Promise<string> {
await (this as any).addAuthorizedAddress.callAsync(target, txData);
const txHash = await (this as any).addAuthorizedAddress.sendTransactionAsync(target, txData);
return txHash;
},
};
/**
* Removes authorizion of an address.
@@ -270,6 +270,11 @@ export class IAssetProxyContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(target: string, txData?: Partial<TxData> | undefined): Promise<string> {
await (this as any).removeAuthorizedAddress.callAsync(target, txData);
const txHash = await (this as any).removeAuthorizedAddress.sendTransactionAsync(target, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -336,11 +341,6 @@ export class IAssetProxyContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(target: string, txData?: Partial<TxData> | undefined): Promise<string> {
await (this as any).removeAuthorizedAddress.callAsync(target, txData);
const txHash = await (this as any).removeAuthorizedAddress.sendTransactionAsync(target, txData);
return txHash;
},
};
/**
* Removes authorizion of an address.
@@ -452,6 +452,19 @@ export class IAssetProxyContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(
target: string,
index: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).removeAuthorizedAddressAtIndex.callAsync(target, index, txData);
const txHash = await (this as any).removeAuthorizedAddressAtIndex.sendTransactionAsync(
target,
index,
txData,
);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -531,19 +544,6 @@ export class IAssetProxyContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(
target: string,
index: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).removeAuthorizedAddressAtIndex.callAsync(target, index, txData);
const txHash = await (this as any).removeAuthorizedAddressAtIndex.sendTransactionAsync(
target,
index,
txData,
);
return txHash;
},
};
/**
* Transfers assets. Either succeeds or throws.
@@ -679,6 +679,17 @@ export class IAssetProxyContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(
assetData: string,
from: string,
to: string,
amount: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).transferFrom.callAsync(assetData, from, to, amount, txData);
const txHash = await (this as any).transferFrom.sendTransactionAsync(assetData, from, to, amount, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -770,17 +781,6 @@ export class IAssetProxyContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(
assetData: string,
from: string,
to: string,
amount: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).transferFrom.callAsync(assetData, from, to, amount, txData);
const txHash = await (this as any).transferFrom.sendTransactionAsync(assetData, from, to, amount, txData);
return txHash;
},
};
/**
* Gets the proxy id associated with the proxy address.
@@ -803,19 +803,9 @@ export class IAssetProxyContract extends BaseContract {
}
const self = (this as any) as IAssetProxyContract;
const encodedData = self._strictEncodeArguments('getProxyId()', []);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...callData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
);
callDataWithDefaults.from = callDataWithDefaults.from
? callDataWithDefaults.from.toLowerCase()
: callDataWithDefaults.from;
const encodedDataBytes = Buffer.from(encodedData.substr(2), 'hex');
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
const rawCallResult = await self.evmExecAsync(encodedDataBytes);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
const abiEncoder = self._lookupAbiEncoder('getProxyId()');
// tslint:disable boolean-naming
@@ -993,6 +983,11 @@ export class IAssetProxyContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(newOwner: string, txData?: Partial<TxData> | undefined): Promise<string> {
await (this as any).transferOwnership.callAsync(newOwner, txData);
const txHash = await (this as any).transferOwnership.sendTransactionAsync(newOwner, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -1057,11 +1052,6 @@ export class IAssetProxyContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(newOwner: string, txData?: Partial<TxData> | undefined): Promise<string> {
await (this as any).transferOwnership.callAsync(newOwner, txData);
const txHash = await (this as any).transferOwnership.sendTransactionAsync(newOwner, txData);
return txHash;
},
};
public static async deployFrom0xArtifactAsync(
artifact: ContractArtifact | SimpleContractArtifact,

View File

@@ -210,6 +210,11 @@ export class MultiAssetProxyContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(target: string, txData?: Partial<TxData> | undefined): Promise<string> {
await (this as any).addAuthorizedAddress.callAsync(target, txData);
const txHash = await (this as any).addAuthorizedAddress.sendTransactionAsync(target, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -276,11 +281,6 @@ export class MultiAssetProxyContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(target: string, txData?: Partial<TxData> | undefined): Promise<string> {
await (this as any).addAuthorizedAddress.callAsync(target, txData);
const txHash = await (this as any).addAuthorizedAddress.sendTransactionAsync(target, txData);
return txHash;
},
};
public authorities = {
/**
@@ -509,6 +509,11 @@ export class MultiAssetProxyContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(target: string, txData?: Partial<TxData> | undefined): Promise<string> {
await (this as any).removeAuthorizedAddress.callAsync(target, txData);
const txHash = await (this as any).removeAuthorizedAddress.sendTransactionAsync(target, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -575,11 +580,6 @@ export class MultiAssetProxyContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(target: string, txData?: Partial<TxData> | undefined): Promise<string> {
await (this as any).removeAuthorizedAddress.callAsync(target, txData);
const txHash = await (this as any).removeAuthorizedAddress.sendTransactionAsync(target, txData);
return txHash;
},
};
public owner = {
/**
@@ -753,6 +753,19 @@ export class MultiAssetProxyContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(
target: string,
index: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).removeAuthorizedAddressAtIndex.callAsync(target, index, txData);
const txHash = await (this as any).removeAuthorizedAddressAtIndex.sendTransactionAsync(
target,
index,
txData,
);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -832,19 +845,6 @@ export class MultiAssetProxyContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(
target: string,
index: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).removeAuthorizedAddressAtIndex.callAsync(target, index, txData);
const txHash = await (this as any).removeAuthorizedAddressAtIndex.sendTransactionAsync(
target,
index,
txData,
);
return txHash;
},
};
/**
* Gets the proxy id associated with the proxy address.
@@ -867,19 +867,9 @@ export class MultiAssetProxyContract extends BaseContract {
}
const self = (this as any) as MultiAssetProxyContract;
const encodedData = self._strictEncodeArguments('getProxyId()', []);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...callData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
);
callDataWithDefaults.from = callDataWithDefaults.from
? callDataWithDefaults.from.toLowerCase()
: callDataWithDefaults.from;
const encodedDataBytes = Buffer.from(encodedData.substr(2), 'hex');
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
const rawCallResult = await self.evmExecAsync(encodedDataBytes);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
const abiEncoder = self._lookupAbiEncoder('getProxyId()');
// tslint:disable boolean-naming
@@ -1068,6 +1058,14 @@ export class MultiAssetProxyContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(
assetProxy: string,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).registerAssetProxy.callAsync(assetProxy, txData);
const txHash = await (this as any).registerAssetProxy.sendTransactionAsync(assetProxy, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -1138,14 +1136,6 @@ export class MultiAssetProxyContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(
assetProxy: string,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).registerAssetProxy.callAsync(assetProxy, txData);
const txHash = await (this as any).registerAssetProxy.sendTransactionAsync(assetProxy, txData);
return txHash;
},
};
/**
* Gets all authorized addresses.
@@ -1292,6 +1282,11 @@ export class MultiAssetProxyContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(newOwner: string, txData?: Partial<TxData> | undefined): Promise<string> {
await (this as any).transferOwnership.callAsync(newOwner, txData);
const txHash = await (this as any).transferOwnership.sendTransactionAsync(newOwner, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -1356,11 +1351,6 @@ export class MultiAssetProxyContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(newOwner: string, txData?: Partial<TxData> | undefined): Promise<string> {
await (this as any).transferOwnership.callAsync(newOwner, txData);
const txHash = await (this as any).transferOwnership.sendTransactionAsync(newOwner, txData);
return txHash;
},
};
private readonly _subscriptionManager: SubscriptionManager<MultiAssetProxyEventArgs, MultiAssetProxyEvents>;
public static async deployFrom0xArtifactAsync(

View File

@@ -147,19 +147,9 @@ export class StaticCallProxyContract extends BaseContract {
}
const self = (this as any) as StaticCallProxyContract;
const encodedData = self._strictEncodeArguments('getProxyId()', []);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...callData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
);
callDataWithDefaults.from = callDataWithDefaults.from
? callDataWithDefaults.from.toLowerCase()
: callDataWithDefaults.from;
const encodedDataBytes = Buffer.from(encodedData.substr(2), 'hex');
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
const rawCallResult = await self.evmExecAsync(encodedDataBytes);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
const abiEncoder = self._lookupAbiEncoder('getProxyId()');
// tslint:disable boolean-naming

View File

@@ -215,6 +215,15 @@ export class WETH9Contract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(
guy: string,
wad: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).approve.callAsync(guy, wad, txData);
const txHash = await (this as any).approve.sendTransactionAsync(guy, wad, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -287,15 +296,6 @@ export class WETH9Contract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<boolean>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(
guy: string,
wad: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).approve.callAsync(guy, wad, txData);
const txHash = await (this as any).approve.sendTransactionAsync(guy, wad, txData);
return txHash;
},
};
public totalSupply = {
/**
@@ -469,6 +469,16 @@ export class WETH9Contract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(
src: string,
dst: string,
wad: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).transferFrom.callAsync(src, dst, wad, txData);
const txHash = await (this as any).transferFrom.sendTransactionAsync(src, dst, wad, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -549,16 +559,6 @@ export class WETH9Contract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<boolean>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(
src: string,
dst: string,
wad: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).transferFrom.callAsync(src, dst, wad, txData);
const txHash = await (this as any).transferFrom.sendTransactionAsync(src, dst, wad, txData);
return txHash;
},
};
public withdraw = {
/**
@@ -639,6 +639,11 @@ export class WETH9Contract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(wad: BigNumber, txData?: Partial<TxData> | undefined): Promise<string> {
await (this as any).withdraw.callAsync(wad, txData);
const txHash = await (this as any).withdraw.sendTransactionAsync(wad, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -701,11 +706,6 @@ export class WETH9Contract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(wad: BigNumber, txData?: Partial<TxData> | undefined): Promise<string> {
await (this as any).withdraw.callAsync(wad, txData);
const txHash = await (this as any).withdraw.sendTransactionAsync(wad, txData);
return txHash;
},
};
public decimals = {
/**
@@ -984,6 +984,15 @@ export class WETH9Contract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(
dst: string,
wad: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).transfer.callAsync(dst, wad, txData);
const txHash = await (this as any).transfer.sendTransactionAsync(dst, wad, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -1056,15 +1065,6 @@ export class WETH9Contract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<boolean>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(
dst: string,
wad: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).transfer.callAsync(dst, wad, txData);
const txHash = await (this as any).transfer.sendTransactionAsync(dst, wad, txData);
return txHash;
},
};
public deposit = {
/**
@@ -1141,6 +1141,11 @@ export class WETH9Contract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(txData?: Partial<TxData> | undefined): Promise<string> {
await (this as any).deposit.callAsync(txData);
const txHash = await (this as any).deposit.sendTransactionAsync(txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -1201,11 +1206,6 @@ export class WETH9Contract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(txData?: Partial<TxData> | undefined): Promise<string> {
await (this as any).deposit.callAsync(txData);
const txHash = await (this as any).deposit.sendTransactionAsync(txData);
return txHash;
},
};
public allowance = {
/**

View File

@@ -213,6 +213,15 @@ export class ZRXTokenContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(
_spender: string,
_value: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).approve.callAsync(_spender, _value, txData);
const txHash = await (this as any).approve.sendTransactionAsync(_spender, _value, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -288,15 +297,6 @@ export class ZRXTokenContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<boolean>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(
_spender: string,
_value: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).approve.callAsync(_spender, _value, txData);
const txHash = await (this as any).approve.sendTransactionAsync(_spender, _value, txData);
return txHash;
},
};
public totalSupply = {
/**
@@ -482,6 +482,16 @@ export class ZRXTokenContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(
_from: string,
_to: string,
_value: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).transferFrom.callAsync(_from, _to, _value, txData);
const txHash = await (this as any).transferFrom.sendTransactionAsync(_from, _to, _value, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -569,16 +579,6 @@ export class ZRXTokenContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<boolean>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(
_from: string,
_to: string,
_value: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).transferFrom.callAsync(_from, _to, _value, txData);
const txHash = await (this as any).transferFrom.sendTransactionAsync(_from, _to, _value, txData);
return txHash;
},
};
public decimals = {
/**
@@ -859,6 +859,15 @@ export class ZRXTokenContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(
_to: string,
_value: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).transfer.callAsync(_to, _value, txData);
const txHash = await (this as any).transfer.sendTransactionAsync(_to, _value, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -931,15 +940,6 @@ export class ZRXTokenContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<boolean>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(
_to: string,
_value: BigNumber,
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).transfer.callAsync(_to, _value, txData);
const txHash = await (this as any).transfer.sendTransactionAsync(_to, _value, txData);
return txHash;
},
};
public allowance = {
/**

View File

@@ -1,4 +1,13 @@
[
{
"version": "4.2.1",
"changes": [
{
"note": "Redirect to `evmExecAsync` to use local EVM instead of eth_call for pure functions",
"pr": 2108
}
]
},
{
"version": "4.2.0",
"changes": [

View File

@@ -13,12 +13,12 @@
"clean": "shx rm -rf lib && yarn test_cli:clean",
"build": "tsc -b && yarn generate_contract_wrappers && yarn prettier_contract_wrappers && yarn test_cli:build",
"build:ci": "yarn build",
"test": "yarn run_mocha && yarn test_cli",
"test": "run-p run_mocha && yarn test_cli",
"test:circleci": "yarn test:coverage && yarn test_cli",
"run_mocha": "(uname -s | grep -q Darwin && echo 'HACK! skipping mocha run due to https://github.com/0xProject/0x-monorepo/issues/2000') || mocha --require source-map-support/register --require make-promises-safe lib/test/*_test.js --timeout 100000 --bail --exit",
"test:coverage": "nyc npm run test --all && yarn coverage:report:lcov",
"coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info",
"test_cli": "run-p test_cli:test_typescript diff_contract_wrappers",
"test_cli": "run-s test_cli:test_typescript diff_contract_wrappers",
"test_cli:clean": "rm -rf test-cli/test_typescript/lib",
"test_cli:build": "tsc --project test-cli/tsconfig.json",
"test_cli:test_typescript": "mocha --require source-map-support/register --require make-promises-safe test-cli/test_typescript/lib/**/*_test.js --timeout 100000 --bail --exit",

View File

@@ -55,13 +55,18 @@ export class {{contractName}}Contract extends BaseContract {
/**
* {{formatDocstringForMethodTs this.devdoc.details}}
*/
{{/if}}
{{#this.constant}}
{{> call contractName=../contractName}}
{{/this.constant}}
{{^this.constant}}
{{> tx contractName=../contractName}}
{{/this.constant}}
{{/if}}
public {{languageSpecificName}} = {
{{^this.constant}}
{{> method_tx contractName=../contractName}}
{{/this.constant}}
{{#ifEquals this.stateMutability "pure"}}
{{> method_call_pure contractName=../contractName}}
{{else}}
{{> method_call contractName=../contractName}}
{{/ifEquals}}
{{> method_abi_helper contractName=../contractName}}
};
{{/each}}
{{#if events}}private readonly _subscriptionManager: SubscriptionManager<{{contractName}}EventArgs, {{contractName}}Events>;
{{/if}}public static async deployFrom0xArtifactAsync(

View File

@@ -1,3 +0,0 @@
public {{languageSpecificName}} = {
{{> callAsync}}
};

View File

@@ -0,0 +1,34 @@
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
{{> params_docstring inputs=inputs docstrings=devdoc.params}}
*/
getABIEncodedTransactionData(
{{> typed_params inputs=inputs}}
): string {
{{#each inputs}}
{{#assertionType name type}}{{/assertionType}}
{{/each}}
const self = this as any as {{contractName}}Contract;
const abiEncodedTransactionData = self._strictEncodeArguments('{{this.functionSignature}}', [{{> normalized_params inputs=inputs}}]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(
callData: string
): ({{> return_type inputs=inputs ~}}) {
const self = this as any as {{contractName}}Contract;
const abiEncoder = self._lookupAbiEncoder('{{this.functionSignature}}');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<{{> return_type inputs=inputs}}>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(
returnData: string
): ({{> return_type outputs=outputs ~}}) {
const self = this as any as {{contractName}}Contract;
const abiEncoder = self._lookupAbiEncoder('{{this.functionSignature}}');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<{{> return_type outputs=outputs}}>(returnData);
return abiDecodedReturnData;
},

View File

@@ -43,37 +43,3 @@ async callAsync(
// tslint:enable boolean-naming
return result;
},
/**
* Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before
* sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used
* to create a 0x transaction (see protocol spec for more details).
{{> params_docstring inputs=inputs docstrings=devdoc.params}}
*/
getABIEncodedTransactionData(
{{> typed_params inputs=inputs}}
): string {
{{#each inputs}}
{{#assertionType name type}}{{/assertionType}}
{{/each}}
const self = this as any as {{contractName}}Contract;
const abiEncodedTransactionData = self._strictEncodeArguments('{{this.functionSignature}}', [{{> normalized_params inputs=inputs}}]);
return abiEncodedTransactionData;
},
getABIDecodedTransactionData(
callData: string
): ({{> return_type inputs=inputs ~}}) {
const self = this as any as {{contractName}}Contract;
const abiEncoder = self._lookupAbiEncoder('{{this.functionSignature}}');
// tslint:disable boolean-naming
const abiDecodedCallData = abiEncoder.strictDecode<{{> return_type inputs=inputs}}>(callData);
return abiDecodedCallData;
},
getABIDecodedReturnData(
returnData: string
): ({{> return_type outputs=outputs ~}}) {
const self = this as any as {{contractName}}Contract;
const abiEncoder = self._lookupAbiEncoder('{{this.functionSignature}}');
// tslint:disable boolean-naming
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<{{> return_type outputs=outputs}}>(returnData);
return abiDecodedReturnData;
},

View File

@@ -0,0 +1,37 @@
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
* since they don't modify state.
{{> params_docstring inputs=inputs docstrings=devdoc.params}}
{{#if devdoc.return}}
* @returns {{devdoc.return}}
{{/if}}
*/
async callAsync(
{{> typed_params inputs=inputs}}
callData: Partial<CallData> = {},
defaultBlock?: BlockParam,
): Promise<{{> return_type outputs=outputs}}> {
{{#each inputs}}
{{#assertionType name type}}{{/assertionType}}
{{/each}}
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
schemas.addressSchema,
schemas.numberSchema,
schemas.jsNumber,
]);
if (defaultBlock !== undefined) {
assert.isBlockParam('defaultBlock', defaultBlock);
}
const self = this as any as {{contractName}}Contract;
const encodedData = self._strictEncodeArguments('{{this.functionSignature}}', [{{> normalized_params inputs=inputs}}]);
const encodedDataBytes = Buffer.from(encodedData.substr(2), 'hex');
const rawCallResult = await self.evmExecAsync(encodedDataBytes);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
const abiEncoder = self._lookupAbiEncoder('{{this.functionSignature}}');
// tslint:disable boolean-naming
const result = abiEncoder.strictDecodeReturnValue<{{> return_type outputs=outputs}}>(rawCallResult);
// tslint:enable boolean-naming
return result;
},

View File

@@ -1,15 +1,14 @@
public {{languageSpecificName}} = {
/**
* Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write
* Ethereum operation and will cost gas.
{{> params_docstring inputs=inputs docstrings=devdoc.params}}
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async sendTransactionAsync(
{{> typed_params inputs=inputs}}
txData?: Partial<TxData> | undefined,
): Promise<string> {
/**
* Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write
* Ethereum operation and will cost gas.
{{> params_docstring inputs=inputs docstrings=devdoc.params}}
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async sendTransactionAsync(
{{> typed_params inputs=inputs}}
txData?: Partial<TxData> | undefined,
): Promise<string> {
{{#each inputs}}
{{#assertionType name type}}{{/assertionType}}
{{/each}}
@@ -33,21 +32,21 @@ public {{languageSpecificName}} = {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
/**
* Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting.
* If the transaction was mined, but reverted, an error is thrown.
{{> params_docstring inputs=inputs docstrings=devdoc.params}}
* @param txData Additional data for transaction
* @param pollingIntervalMs Interval at which to poll for success
* @returns A promise that resolves when the transaction is successful
*/
awaitTransactionSuccessAsync(
{{> typed_params inputs=inputs}}
txData?: Partial<TxData>,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
},
/**
* Sends an Ethereum transaction and waits until the transaction has been successfully mined without reverting.
* If the transaction was mined, but reverted, an error is thrown.
{{> params_docstring inputs=inputs docstrings=devdoc.params}}
* @param txData Additional data for transaction
* @param pollingIntervalMs Interval at which to poll for success
* @returns A promise that resolves when the transaction is successful
*/
awaitTransactionSuccessAsync(
{{> typed_params inputs=inputs}}
txData?: Partial<TxData>,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
{{#each inputs}}
{{#assertionType name type}}{{/assertionType}}
{{/each}}
@@ -68,17 +67,17 @@ public {{languageSpecificName}} = {
);
})(),
);
},
/**
* Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments.
{{> params_docstring inputs=inputs docstrings=devdoc.params}}
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async estimateGasAsync(
{{> typed_params inputs=inputs}}
txData?: Partial<TxData> | undefined,
): Promise<number> {
},
/**
* Estimates the gas cost of sending an Ethereum transaction calling this method with these arguments.
{{> params_docstring inputs=inputs docstrings=devdoc.params}}
* @param txData Additional data for transaction
* @returns The hash of the transaction
*/
async estimateGasAsync(
{{> typed_params inputs=inputs}}
txData?: Partial<TxData> | undefined,
): Promise<number> {
{{#each inputs}}
{{#assertionType name type}}{{/assertionType}}
{{/each}}
@@ -95,27 +94,25 @@ public {{languageSpecificName}} = {
if (txDataWithDefaults.from !== undefined) {
txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase();
}
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
{{> callAsync}}
async validateAndSendTransactionAsync(
{{> typed_params inputs=inputs}}
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).{{languageSpecificName}}.callAsync(
{{#each inputs~}}
{{name}},
{{/each~}}
txData,
);
const txHash = await (this as any).{{languageSpecificName}}.sendTransactionAsync(
{{#each inputs~}}
{{name}},
{{/each~}}
txData,
);
return txHash;
}
};
},
async validateAndSendTransactionAsync(
{{> typed_params inputs=inputs}}
txData?: Partial<TxData> | undefined,
): Promise<string> {
await (this as any).{{languageSpecificName}}.callAsync(
{{#each inputs~}}
{{name}},
{{/each~}}
txData,
);
const txHash = await (this as any).{{languageSpecificName}}.sendTransactionAsync(
{{#each inputs~}}
{{name}},
{{/each~}}
txData,
);
return txHash;
},

View File

@@ -68,19 +68,9 @@ export class AbiGenDummyContract extends BaseContract {
}
const self = (this as any) as AbiGenDummyContract;
const encodedData = self._strictEncodeArguments('simpleRequire()', []);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...callData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
);
callDataWithDefaults.from = callDataWithDefaults.from
? callDataWithDefaults.from.toLowerCase()
: callDataWithDefaults.from;
const encodedDataBytes = Buffer.from(encodedData.substr(2), 'hex');
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
const rawCallResult = await self.evmExecAsync(encodedDataBytes);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
const abiEncoder = self._lookupAbiEncoder('simpleRequire()');
// tslint:disable boolean-naming
@@ -135,19 +125,9 @@ export class AbiGenDummyContract extends BaseContract {
}
const self = (this as any) as AbiGenDummyContract;
const encodedData = self._strictEncodeArguments('acceptsAnArrayOfBytes(bytes[])', [a]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...callData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
);
callDataWithDefaults.from = callDataWithDefaults.from
? callDataWithDefaults.from.toLowerCase()
: callDataWithDefaults.from;
const encodedDataBytes = Buffer.from(encodedData.substr(2), 'hex');
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
const rawCallResult = await self.evmExecAsync(encodedDataBytes);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
const abiEncoder = self._lookupAbiEncoder('acceptsAnArrayOfBytes(bytes[])');
// tslint:disable boolean-naming
@@ -207,19 +187,9 @@ export class AbiGenDummyContract extends BaseContract {
}
const self = (this as any) as AbiGenDummyContract;
const encodedData = self._strictEncodeArguments('simpleInputSimpleOutput(uint256)', [index_0]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...callData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
);
callDataWithDefaults.from = callDataWithDefaults.from
? callDataWithDefaults.from.toLowerCase()
: callDataWithDefaults.from;
const encodedDataBytes = Buffer.from(encodedData.substr(2), 'hex');
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
const rawCallResult = await self.evmExecAsync(encodedDataBytes);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
const abiEncoder = self._lookupAbiEncoder('simpleInputSimpleOutput(uint256)');
// tslint:disable boolean-naming
@@ -334,6 +304,11 @@ export class AbiGenDummyContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(wad: BigNumber, txData?: Partial<TxData> | undefined): Promise<string> {
await (this as any).withdraw.callAsync(wad, txData);
const txHash = await (this as any).withdraw.sendTransactionAsync(wad, txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -396,11 +371,6 @@ export class AbiGenDummyContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(wad: BigNumber, txData?: Partial<TxData> | undefined): Promise<string> {
await (this as any).withdraw.callAsync(wad, txData);
const txHash = await (this as any).withdraw.sendTransactionAsync(wad, txData);
return txHash;
},
};
/**
* Tests decoding when the input and output are complex and have more than one argument.
@@ -435,19 +405,9 @@ export class AbiGenDummyContract extends BaseContract {
index_1,
index_2,
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...callData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
);
callDataWithDefaults.from = callDataWithDefaults.from
? callDataWithDefaults.from.toLowerCase()
: callDataWithDefaults.from;
const encodedDataBytes = Buffer.from(encodedData.substr(2), 'hex');
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
const rawCallResult = await self.evmExecAsync(encodedDataBytes);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
const abiEncoder = self._lookupAbiEncoder('multiInputMultiOutput(uint256,bytes,string)');
// tslint:disable boolean-naming
@@ -530,19 +490,9 @@ export class AbiGenDummyContract extends BaseContract {
r,
s,
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...callData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
);
callDataWithDefaults.from = callDataWithDefaults.from
? callDataWithDefaults.from.toLowerCase()
: callDataWithDefaults.from;
const encodedDataBytes = Buffer.from(encodedData.substr(2), 'hex');
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
const rawCallResult = await self.evmExecAsync(encodedDataBytes);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
const abiEncoder = self._lookupAbiEncoder('ecrecoverFn(bytes32,uint8,bytes32,bytes32)');
// tslint:disable boolean-naming
@@ -606,19 +556,9 @@ export class AbiGenDummyContract extends BaseContract {
}
const self = (this as any) as AbiGenDummyContract;
const encodedData = self._strictEncodeArguments('acceptsBytes(bytes)', [a]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...callData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
);
callDataWithDefaults.from = callDataWithDefaults.from
? callDataWithDefaults.from.toLowerCase()
: callDataWithDefaults.from;
const encodedDataBytes = Buffer.from(encodedData.substr(2), 'hex');
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
const rawCallResult = await self.evmExecAsync(encodedDataBytes);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
const abiEncoder = self._lookupAbiEncoder('acceptsBytes(bytes)');
// tslint:disable boolean-naming
@@ -672,19 +612,9 @@ export class AbiGenDummyContract extends BaseContract {
}
const self = (this as any) as AbiGenDummyContract;
const encodedData = self._strictEncodeArguments('noInputSimpleOutput()', []);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...callData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
);
callDataWithDefaults.from = callDataWithDefaults.from
? callDataWithDefaults.from.toLowerCase()
: callDataWithDefaults.from;
const encodedDataBytes = Buffer.from(encodedData.substr(2), 'hex');
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
const rawCallResult = await self.evmExecAsync(encodedDataBytes);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
const abiEncoder = self._lookupAbiEncoder('noInputSimpleOutput()');
// tslint:disable boolean-naming
@@ -734,19 +664,9 @@ export class AbiGenDummyContract extends BaseContract {
}
const self = (this as any) as AbiGenDummyContract;
const encodedData = self._strictEncodeArguments('revertWithConstant()', []);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...callData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
);
callDataWithDefaults.from = callDataWithDefaults.from
? callDataWithDefaults.from.toLowerCase()
: callDataWithDefaults.from;
const encodedDataBytes = Buffer.from(encodedData.substr(2), 'hex');
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
const rawCallResult = await self.evmExecAsync(encodedDataBytes);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
const abiEncoder = self._lookupAbiEncoder('revertWithConstant()');
// tslint:disable boolean-naming
@@ -796,19 +716,9 @@ export class AbiGenDummyContract extends BaseContract {
}
const self = (this as any) as AbiGenDummyContract;
const encodedData = self._strictEncodeArguments('simpleRevert()', []);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...callData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
);
callDataWithDefaults.from = callDataWithDefaults.from
? callDataWithDefaults.from.toLowerCase()
: callDataWithDefaults.from;
const encodedDataBytes = Buffer.from(encodedData.substr(2), 'hex');
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
const rawCallResult = await self.evmExecAsync(encodedDataBytes);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
const abiEncoder = self._lookupAbiEncoder('simpleRevert()');
// tslint:disable boolean-naming
@@ -864,19 +774,9 @@ export class AbiGenDummyContract extends BaseContract {
'methodUsingNestedStructWithInnerStructNotUsedElsewhere()',
[],
);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...callData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
);
callDataWithDefaults.from = callDataWithDefaults.from
? callDataWithDefaults.from.toLowerCase()
: callDataWithDefaults.from;
const encodedDataBytes = Buffer.from(encodedData.substr(2), 'hex');
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
const rawCallResult = await self.evmExecAsync(encodedDataBytes);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
const abiEncoder = self._lookupAbiEncoder('methodUsingNestedStructWithInnerStructNotUsedElsewhere()');
// tslint:disable boolean-naming
@@ -937,19 +837,9 @@ export class AbiGenDummyContract extends BaseContract {
}
const self = (this as any) as AbiGenDummyContract;
const encodedData = self._strictEncodeArguments('nestedStructOutput()', []);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...callData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
);
callDataWithDefaults.from = callDataWithDefaults.from
? callDataWithDefaults.from.toLowerCase()
: callDataWithDefaults.from;
const encodedDataBytes = Buffer.from(encodedData.substr(2), 'hex');
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
const rawCallResult = await self.evmExecAsync(encodedDataBytes);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
const abiEncoder = self._lookupAbiEncoder('nestedStructOutput()');
// tslint:disable boolean-naming
@@ -1018,19 +908,9 @@ export class AbiGenDummyContract extends BaseContract {
}
const self = (this as any) as AbiGenDummyContract;
const encodedData = self._strictEncodeArguments('requireWithConstant()', []);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...callData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
);
callDataWithDefaults.from = callDataWithDefaults.from
? callDataWithDefaults.from.toLowerCase()
: callDataWithDefaults.from;
const encodedDataBytes = Buffer.from(encodedData.substr(2), 'hex');
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
const rawCallResult = await self.evmExecAsync(encodedDataBytes);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
const abiEncoder = self._lookupAbiEncoder('requireWithConstant()');
// tslint:disable boolean-naming
@@ -1096,19 +976,9 @@ export class AbiGenDummyContract extends BaseContract {
'withAddressInput(address,uint256,uint256,address,uint256)',
[x.toLowerCase(), a, b, y.toLowerCase(), c],
);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...callData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
);
callDataWithDefaults.from = callDataWithDefaults.from
? callDataWithDefaults.from.toLowerCase()
: callDataWithDefaults.from;
const encodedDataBytes = Buffer.from(encodedData.substr(2), 'hex');
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
const rawCallResult = await self.evmExecAsync(encodedDataBytes);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
const abiEncoder = self._lookupAbiEncoder('withAddressInput(address,uint256,uint256,address,uint256)');
// tslint:disable boolean-naming
@@ -1170,19 +1040,9 @@ export class AbiGenDummyContract extends BaseContract {
}
const self = (this as any) as AbiGenDummyContract;
const encodedData = self._strictEncodeArguments('structInput((bytes,uint32,bytes[],string))', [s]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...callData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
);
callDataWithDefaults.from = callDataWithDefaults.from
? callDataWithDefaults.from.toLowerCase()
: callDataWithDefaults.from;
const encodedDataBytes = Buffer.from(encodedData.substr(2), 'hex');
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
const rawCallResult = await self.evmExecAsync(encodedDataBytes);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
const abiEncoder = self._lookupAbiEncoder('structInput((bytes,uint32,bytes[],string))');
// tslint:disable boolean-naming
@@ -1298,6 +1158,11 @@ export class AbiGenDummyContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(txData?: Partial<TxData> | undefined): Promise<string> {
await (this as any).nonPureMethod.callAsync(txData);
const txHash = await (this as any).nonPureMethod.sendTransactionAsync(txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -1358,11 +1223,6 @@ export class AbiGenDummyContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<BigNumber>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(txData?: Partial<TxData> | undefined): Promise<string> {
await (this as any).nonPureMethod.callAsync(txData);
const txHash = await (this as any).nonPureMethod.sendTransactionAsync(txData);
return txHash;
},
};
/**
* Tests decoding when the input and output are complex.
@@ -1395,19 +1255,9 @@ export class AbiGenDummyContract extends BaseContract {
const encodedData = self._strictEncodeArguments('complexInputComplexOutput((uint256,bytes,string))', [
complexInput,
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...callData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
);
callDataWithDefaults.from = callDataWithDefaults.from
? callDataWithDefaults.from.toLowerCase()
: callDataWithDefaults.from;
const encodedDataBytes = Buffer.from(encodedData.substr(2), 'hex');
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
const rawCallResult = await self.evmExecAsync(encodedDataBytes);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
const abiEncoder = self._lookupAbiEncoder('complexInputComplexOutput((uint256,bytes,string))');
// tslint:disable boolean-naming
@@ -1482,19 +1332,9 @@ export class AbiGenDummyContract extends BaseContract {
}
const self = (this as any) as AbiGenDummyContract;
const encodedData = self._strictEncodeArguments('noInputNoOutput()', []);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...callData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
);
callDataWithDefaults.from = callDataWithDefaults.from
? callDataWithDefaults.from.toLowerCase()
: callDataWithDefaults.from;
const encodedDataBytes = Buffer.from(encodedData.substr(2), 'hex');
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
const rawCallResult = await self.evmExecAsync(encodedDataBytes);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
const abiEncoder = self._lookupAbiEncoder('noInputNoOutput()');
// tslint:disable boolean-naming
@@ -1545,19 +1385,9 @@ export class AbiGenDummyContract extends BaseContract {
}
const self = (this as any) as AbiGenDummyContract;
const encodedData = self._strictEncodeArguments('simplePureFunctionWithInput(uint256)', [x]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...callData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
);
callDataWithDefaults.from = callDataWithDefaults.from
? callDataWithDefaults.from.toLowerCase()
: callDataWithDefaults.from;
const encodedDataBytes = Buffer.from(encodedData.substr(2), 'hex');
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
const rawCallResult = await self.evmExecAsync(encodedDataBytes);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
const abiEncoder = self._lookupAbiEncoder('simplePureFunctionWithInput(uint256)');
// tslint:disable boolean-naming
@@ -1666,6 +1496,11 @@ export class AbiGenDummyContract extends BaseContract {
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
async validateAndSendTransactionAsync(txData?: Partial<TxData> | undefined): Promise<string> {
await (this as any).nonPureMethodThatReturnsNothing.callAsync(txData);
const txHash = await (this as any).nonPureMethodThatReturnsNothing.sendTransactionAsync(txData);
return txHash;
},
/**
* Sends a read-only call to the contract method. Returns the result that would happen if one were to send an
* Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas
@@ -1726,11 +1561,6 @@ export class AbiGenDummyContract extends BaseContract {
const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<void>(returnData);
return abiDecodedReturnData;
},
async validateAndSendTransactionAsync(txData?: Partial<TxData> | undefined): Promise<string> {
await (this as any).nonPureMethodThatReturnsNothing.callAsync(txData);
const txHash = await (this as any).nonPureMethodThatReturnsNothing.sendTransactionAsync(txData);
return txHash;
},
};
public simplePureFunction = {
/**
@@ -1749,19 +1579,9 @@ export class AbiGenDummyContract extends BaseContract {
}
const self = (this as any) as AbiGenDummyContract;
const encodedData = self._strictEncodeArguments('simplePureFunction()', []);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...callData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
);
callDataWithDefaults.from = callDataWithDefaults.from
? callDataWithDefaults.from.toLowerCase()
: callDataWithDefaults.from;
const encodedDataBytes = Buffer.from(encodedData.substr(2), 'hex');
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
const rawCallResult = await self.evmExecAsync(encodedDataBytes);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
const abiEncoder = self._lookupAbiEncoder('simplePureFunction()');
// tslint:disable boolean-naming
@@ -1826,19 +1646,9 @@ export class AbiGenDummyContract extends BaseContract {
'nestedStructInput(((bytes,uint32,bytes[],string),string))',
[n],
);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...callData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
);
callDataWithDefaults.from = callDataWithDefaults.from
? callDataWithDefaults.from.toLowerCase()
: callDataWithDefaults.from;
const encodedDataBytes = Buffer.from(encodedData.substr(2), 'hex');
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
const rawCallResult = await self.evmExecAsync(encodedDataBytes);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
const abiEncoder = self._lookupAbiEncoder('nestedStructInput(((bytes,uint32,bytes[],string),string))');
// tslint:disable boolean-naming
@@ -1899,19 +1709,9 @@ export class AbiGenDummyContract extends BaseContract {
}
const self = (this as any) as AbiGenDummyContract;
const encodedData = self._strictEncodeArguments('methodReturningMultipleValues()', []);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...callData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
);
callDataWithDefaults.from = callDataWithDefaults.from
? callDataWithDefaults.from.toLowerCase()
: callDataWithDefaults.from;
const encodedDataBytes = Buffer.from(encodedData.substr(2), 'hex');
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
const rawCallResult = await self.evmExecAsync(encodedDataBytes);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
const abiEncoder = self._lookupAbiEncoder('methodReturningMultipleValues()');
// tslint:disable boolean-naming
@@ -1964,19 +1764,9 @@ export class AbiGenDummyContract extends BaseContract {
}
const self = (this as any) as AbiGenDummyContract;
const encodedData = self._strictEncodeArguments('methodReturningArrayOfStructs()', []);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...callData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
);
callDataWithDefaults.from = callDataWithDefaults.from
? callDataWithDefaults.from.toLowerCase()
: callDataWithDefaults.from;
const encodedDataBytes = Buffer.from(encodedData.substr(2), 'hex');
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
const rawCallResult = await self.evmExecAsync(encodedDataBytes);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
const abiEncoder = self._lookupAbiEncoder('methodReturningArrayOfStructs()');
// tslint:disable boolean-naming
@@ -2043,19 +1833,9 @@ export class AbiGenDummyContract extends BaseContract {
}
const self = (this as any) as AbiGenDummyContract;
const encodedData = self._strictEncodeArguments('structOutput()', []);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...callData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
);
callDataWithDefaults.from = callDataWithDefaults.from
? callDataWithDefaults.from.toLowerCase()
: callDataWithDefaults.from;
const encodedDataBytes = Buffer.from(encodedData.substr(2), 'hex');
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
const rawCallResult = await self.evmExecAsync(encodedDataBytes);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
const abiEncoder = self._lookupAbiEncoder('structOutput()');
// tslint:disable boolean-naming
@@ -2124,19 +1904,9 @@ export class AbiGenDummyContract extends BaseContract {
}
const self = (this as any) as AbiGenDummyContract;
const encodedData = self._strictEncodeArguments('pureFunctionWithConstant()', []);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...callData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
);
callDataWithDefaults.from = callDataWithDefaults.from
? callDataWithDefaults.from.toLowerCase()
: callDataWithDefaults.from;
const encodedDataBytes = Buffer.from(encodedData.substr(2), 'hex');
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
const rawCallResult = await self.evmExecAsync(encodedDataBytes);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
const abiEncoder = self._lookupAbiEncoder('pureFunctionWithConstant()');
// tslint:disable boolean-naming
@@ -2194,19 +1964,9 @@ export class AbiGenDummyContract extends BaseContract {
}
const self = (this as any) as AbiGenDummyContract;
const encodedData = self._strictEncodeArguments('simpleInputNoOutput(uint256)', [index_0]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...callData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
);
callDataWithDefaults.from = callDataWithDefaults.from
? callDataWithDefaults.from.toLowerCase()
: callDataWithDefaults.from;
const encodedDataBytes = Buffer.from(encodedData.substr(2), 'hex');
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
const rawCallResult = await self.evmExecAsync(encodedDataBytes);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
const abiEncoder = self._lookupAbiEncoder('simpleInputNoOutput(uint256)');
// tslint:disable boolean-naming
@@ -2258,19 +2018,9 @@ export class AbiGenDummyContract extends BaseContract {
}
const self = (this as any) as AbiGenDummyContract;
const encodedData = self._strictEncodeArguments('overloadedMethod(string)', [a]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...callData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
);
callDataWithDefaults.from = callDataWithDefaults.from
? callDataWithDefaults.from.toLowerCase()
: callDataWithDefaults.from;
const encodedDataBytes = Buffer.from(encodedData.substr(2), 'hex');
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
const rawCallResult = await self.evmExecAsync(encodedDataBytes);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
const abiEncoder = self._lookupAbiEncoder('overloadedMethod(string)');
// tslint:disable boolean-naming
@@ -2322,19 +2072,9 @@ export class AbiGenDummyContract extends BaseContract {
}
const self = (this as any) as AbiGenDummyContract;
const encodedData = self._strictEncodeArguments('overloadedMethod(int256)', [a]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...callData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
);
callDataWithDefaults.from = callDataWithDefaults.from
? callDataWithDefaults.from.toLowerCase()
: callDataWithDefaults.from;
const encodedDataBytes = Buffer.from(encodedData.substr(2), 'hex');
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
const rawCallResult = await self.evmExecAsync(encodedDataBytes);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
const abiEncoder = self._lookupAbiEncoder('overloadedMethod(int256)');
// tslint:disable boolean-naming

View File

@@ -46,19 +46,9 @@ export class TestLibDummyContract extends BaseContract {
}
const self = (this as any) as TestLibDummyContract;
const encodedData = self._strictEncodeArguments('publicAddConstant(uint256)', [x]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...callData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
);
callDataWithDefaults.from = callDataWithDefaults.from
? callDataWithDefaults.from.toLowerCase()
: callDataWithDefaults.from;
const encodedDataBytes = Buffer.from(encodedData.substr(2), 'hex');
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
const rawCallResult = await self.evmExecAsync(encodedDataBytes);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
const abiEncoder = self._lookupAbiEncoder('publicAddConstant(uint256)');
// tslint:disable boolean-naming
@@ -110,19 +100,9 @@ export class TestLibDummyContract extends BaseContract {
}
const self = (this as any) as TestLibDummyContract;
const encodedData = self._strictEncodeArguments('publicAddOne(uint256)', [x]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...callData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
);
callDataWithDefaults.from = callDataWithDefaults.from
? callDataWithDefaults.from.toLowerCase()
: callDataWithDefaults.from;
const encodedDataBytes = Buffer.from(encodedData.substr(2), 'hex');
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
const rawCallResult = await self.evmExecAsync(encodedDataBytes);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
const abiEncoder = self._lookupAbiEncoder('publicAddOne(uint256)');
// tslint:disable boolean-naming

View File

@@ -75,22 +75,22 @@ describe('AbiGenDummy Contract', () => {
});
describe('simpleRevert', () => {
it('should call simpleRevert', async () => {
return expectContractCallFailedAsync(abiGenDummy.simpleRevert.callAsync(), 'SIMPLE_REVERT');
expect(abiGenDummy.simpleRevert.callAsync()).to.be.rejectedWith('SIMPLE_REVERT');
});
});
describe('revertWithConstant', () => {
it('should call revertWithConstant', async () => {
return expectContractCallFailedAsync(abiGenDummy.revertWithConstant.callAsync(), 'REVERT_WITH_CONSTANT');
expect(abiGenDummy.revertWithConstant.callAsync()).to.be.rejectedWith('REVERT_WITH_CONSTANT');
});
});
describe('simpleRequire', () => {
it('should call simpleRequire', async () => {
return expectContractCallFailedAsync(abiGenDummy.simpleRequire.callAsync(), 'SIMPLE_REQUIRE');
expect(abiGenDummy.simpleRequire.callAsync()).to.be.rejectedWith('SIMPLE_REQUIRE');
});
});
describe('requireWithConstant', () => {
it('should call requireWithConstant', async () => {
return expectContractCallFailedAsync(abiGenDummy.requireWithConstant.callAsync(), 'REQUIRE_WITH_CONSTANT');
expect(abiGenDummy.requireWithConstant.callAsync()).to.be.rejectedWith('REQUIRE_WITH_CONSTANT');
});
});
@@ -267,16 +267,3 @@ describe('Lib dummy contract', () => {
expect(result).to.deep.equal(new BigNumber(1235));
});
});
// HACK(xianny): copied from @0x/contracts-test-utils to avoid circular dependency
/**
* Resolves if the the contract call fails with the given revert reason.
* @param p a Promise resulting from a contract call
* @param reason a specific revert reason
* @returns a new Promise which will reject if the conditions are not met and
* otherwise resolve with no value.
*/
function expectContractCallFailedAsync<T>(p: Promise<T>, reason: string): Chai.PromisedAssertion {
const rejectionMessageRegex = new RegExp(`^VM Exception while processing transaction: revert ${reason}$`);
return expect(p).to.be.rejectedWith(rejectionMessageRegex);
}

View File

@@ -1,4 +1,13 @@
[
{
"version": "5.4.0",
"changes": [
{
"note": "Add `evmExecAsync` to use local EVM instead of eth_call for pure functions",
"pr": 2108
}
]
},
{
"timestamp": 1567521715,
"version": "5.3.3",

View File

@@ -48,8 +48,10 @@
"@0x/utils": "^4.5.1",
"@0x/web3-wrapper": "^6.0.12",
"ethereum-types": "^2.1.5",
"ethereumjs-account": "^3.0.0",
"ethereumjs-blockstream": "^7.0.0",
"ethereumjs-util": "^5.1.1",
"ethereumjs-vm": "^4.0.0",
"ethers": "~4.0.4",
"js-sha3": "^0.7.0",
"lodash": "^4.17.11",

View File

@@ -14,6 +14,10 @@ import {
TxData,
TxDataPayable,
} from 'ethereum-types';
import Account from 'ethereumjs-account';
import * as util from 'ethereumjs-util';
import { default as VM } from 'ethereumjs-vm';
import PStateManager from 'ethereumjs-vm/dist/state/promisified';
import * as ethers from 'ethers';
import * as _ from 'lodash';
@@ -27,6 +31,8 @@ export interface AbiEncoderByFunctionSignature {
[key: string]: AbiEncoder.Method;
}
const ARBITRARY_PRIVATE_KEY = 'e331b6d69882b4cb4ea581d88e0b604039a3de5967688d3dcffdd2270c0fd109';
// tslint:disable: max-classes-per-file
/**
* @dev A promise-compatible type that exposes a `txHash` field.
@@ -61,6 +67,8 @@ export class BaseContract {
public address: string;
public contractName: string;
public constructorArgs: any[] = [];
private _evmIfExists?: VM;
private _evmAccountIfExists?: Buffer;
protected static _formatABIDataItemList(
abis: DataItem[],
values: any[],
@@ -150,6 +158,38 @@ export class BaseContract {
}
return rawEncoded;
}
public async evmExecAsync(input: Buffer): Promise<string> {
const addressBuf = Buffer.from(this.address.substr(2), 'hex');
// should only run once, the first time it is called
if (this._evmIfExists === undefined) {
const vm = new VM({});
const psm = new PStateManager(vm.stateManager);
// create an account with 1 ETH
const accountPk = Buffer.from(ARBITRARY_PRIVATE_KEY, 'hex');
const accountAddress = util.privateToAddress(accountPk);
const account = new Account({ balance: 1e18 });
await psm.putAccount(accountAddress, account);
// 'deploy' the contract
const contractCode = await this._web3Wrapper.getContractCodeAsync(this.address);
const deployedBytecode = Buffer.from(contractCode.substr(2), 'hex');
await psm.putContractCode(addressBuf, deployedBytecode);
// save for later
this._evmIfExists = vm;
this._evmAccountIfExists = accountAddress;
}
const result = await this._evmIfExists.runCall({
to: addressBuf,
caller: this._evmAccountIfExists,
origin: this._evmAccountIfExists,
data: input,
});
const hexReturnValue = `0x${result.execResult.returnValue.toString('hex')}`;
return hexReturnValue;
}
protected _lookupAbiEncoder(functionSignature: string): AbiEncoder.Method {
const abiEncoder = this._abiEncoderByFunctionSignature[functionSignature];
if (abiEncoder === undefined) {

View File

@@ -4,5 +4,6 @@
"outDir": "lib",
"rootDir": "."
},
"typeRoots": ["node_modules/@0x/typescript-typings/types", "node_modules/@types"],
"include": ["src/**/*", "test/**/*"]
}

View File

@@ -1,4 +1,13 @@
[
{
"version": "3.2.0",
"changes": [
{
"note": "Added `getNetworkIdByExchangeAddressOrThrow`",
"pr": 2096
}
]
},
{
"version": "3.1.0",
"changes": [

View File

@@ -131,3 +131,21 @@ export function getContractAddressesForNetworkOrThrow(networkId: NetworkId): Con
}
return networkToAddresses[networkId];
}
/**
* Uses a given exchange address to look up the network id that the exchange contract is deployed
* on. Only works for Ethereum mainnet or a supported testnet. Throws if the exchange address
* does not correspond to a known deployed exchange contract.
* @param exchangeAddress The exchange address of concern
* @returns The network ID on which the exchange contract is deployed
*/
export function getNetworkIdByExchangeAddressOrThrow(exchangeAddress: string): NetworkId {
for (const networkId of Object.keys(networkToAddresses)) {
if (networkToAddresses[networkId as any].exchange === exchangeAddress) {
return (networkId as any) as NetworkId;
}
}
throw new Error(
`Unknown exchange address (${exchangeAddress}). No known 0x Exchange Contract deployed at this address.`,
);
}

View File

@@ -135,6 +135,13 @@ const generateConfig = (dischargeTarget, heapConfigOptions, rollbarConfigOptions
resolve: {
extensions: ['.js', '.json', '.ts', '.tsx'],
},
// This supports the ethereumjs-vm dependency in `@0x/base-contract`
// The .wasm 'glue' code generated by Emscripten requires these node builtins,
// but won't actually use them in a web environment. We tell Webpack to not resolve those
// require statements since we know we won't need them.
externals: {
fs: true,
},
module: {
rules: [
{

View File

@@ -1,4 +1,13 @@
[
{
"version": "4.3.2",
"changes": [
{
"note": "Removed dependency on @0x/order-utils",
"pr": 2096
}
]
},
{
"timestamp": 1567521715,
"version": "4.3.1",

View File

@@ -59,7 +59,6 @@
"@0x/base-contract": "^5.3.3",
"@0x/contract-addresses": "^3.1.0",
"@0x/contract-artifacts": "^2.2.1",
"@0x/order-utils": "^8.3.1",
"@0x/sol-compiler": "^3.1.14",
"@0x/subproviders": "^5.0.3",
"@0x/typescript-typings": "^4.2.5",

View File

@@ -1,15 +1,43 @@
import * as wrappers from '@0x/abi-gen-wrappers';
import { ContractAddresses } from '@0x/contract-addresses';
import * as artifacts from '@0x/contract-artifacts';
import { assetDataUtils } from '@0x/order-utils';
import { Web3ProviderEngine } from '@0x/subproviders';
import { BigNumber, providerUtils } from '@0x/utils';
import { AbiEncoder, BigNumber, providerUtils } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
import { SupportedProvider, TxData } from 'ethereum-types';
import { MethodAbi, SupportedProvider, TxData } from 'ethereum-types';
import * as _ from 'lodash';
import { erc20TokenInfo, erc721TokenInfo } from './utils/token_info';
// HACK (xianny): Copied from @0x/order-utils to get rid of circular dependency
/**
* Encodes an ERC20 token address into a hex encoded assetData string, usable in the makerAssetData or
* takerAssetData fields in a 0x order.
* @param tokenAddress The ERC20 token address to encode
* @return The hex encoded assetData string
*/
function encodeERC20AssetData(tokenAddress: string): string {
const ERC20_METHOD_ABI: MethodAbi = {
constant: false,
inputs: [
{
name: 'tokenContract',
type: 'address',
},
],
name: 'ERC20Token',
outputs: [],
payable: false,
stateMutability: 'nonpayable',
type: 'function',
};
const encodingRules: AbiEncoder.EncodingRules = { shouldOptimize: true };
const abiEncoder = new AbiEncoder.Method(ERC20_METHOD_ABI);
const args = [tokenAddress];
const assetData = abiEncoder.encode(args, encodingRules);
return assetData;
}
/**
* Creates and deploys all the contracts that are required for the latest
* version of the 0x protocol.
@@ -55,7 +83,7 @@ export async function runMigrationsAsync(
);
// Exchange
const zrxAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address);
const zrxAssetData = encodeERC20AssetData(zrxToken.address);
const exchange = await wrappers.ExchangeContract.deployFrom0xArtifactAsync(
artifacts.Exchange,
provider,
@@ -173,8 +201,8 @@ export async function runMigrationsAsync(
txDefaults,
artifacts,
exchange.address,
assetDataUtils.encodeERC20AssetData(zrxToken.address),
assetDataUtils.encodeERC20AssetData(etherToken.address),
encodeERC20AssetData(zrxToken.address),
encodeERC20AssetData(etherToken.address),
);
// OrderValidator

View File

@@ -1,4 +1,13 @@
[
{
"version": "8.4.0",
"changes": [
{
"note": "Implement `simpleValidateOrderFillableOrThrowAsync`",
"pr": 2096
}
]
},
{
"timestamp": 1567521715,
"version": "8.3.1",

View File

@@ -13,7 +13,7 @@
"test": "yarn run_mocha",
"rebuild_and_test": "run-s build test",
"test:circleci": "yarn test:coverage",
"run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js --bail --exit",
"run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js --timeout 10000 --bail --exit",
"test:coverage": "nyc npm run test --all && yarn coverage:report:lcov",
"coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info",
"clean": "shx rm -rf lib generated_docs",
@@ -40,6 +40,8 @@
"homepage": "https://github.com/0xProject/0x-monorepo/packages/order-utils/README.md",
"devDependencies": {
"@0x/dev-utils": "^2.3.2",
"@0x/migrations": "^4.3.1",
"@0x/subproviders": "^5.0.3",
"@0x/ts-doc-gen": "^0.0.21",
"@0x/tslint-config": "^3.0.1",
"@types/bn.js": "^4.11.0",

View File

@@ -0,0 +1,20 @@
import { DevUtilsContract } from '@0x/abi-gen-wrappers';
import { BigNumber } from '@0x/utils';
import * as _ from 'lodash';
import { AbstractBalanceAndProxyAllowanceFetcher } from './abstract/abstract_balance_and_proxy_allowance_fetcher';
export class AssetBalanceAndProxyAllowanceFetcher implements AbstractBalanceAndProxyAllowanceFetcher {
private readonly _devUtilsContract: DevUtilsContract;
constructor(devUtilsContract: DevUtilsContract) {
this._devUtilsContract = devUtilsContract;
}
public async getBalanceAsync(assetData: string, userAddress: string): Promise<BigNumber> {
const balance = await this._devUtilsContract.getBalance.callAsync(userAddress, assetData);
return balance;
}
public async getProxyAllowanceAsync(assetData: string, userAddress: string): Promise<BigNumber> {
const proxyAllowance = await this._devUtilsContract.getAssetProxyAllowance.callAsync(userAddress, assetData);
return proxyAllowance;
}
}

View File

@@ -80,6 +80,7 @@ export {
FeeOrdersAndRemainingFeeAmount,
OrdersAndRemainingTakerFillAmount,
OrdersAndRemainingMakerFillAmount,
ValidateOrderFillableOpts,
} from './types';
export { NetworkId } from '@0x/contract-addresses';

View File

@@ -1,21 +1,29 @@
import {
DevUtilsContract,
ExchangeContract,
getContractAddressesForNetworkOrThrow,
IAssetProxyContract,
NetworkId,
} from '@0x/abi-gen-wrappers';
import { assert } from '@0x/assert';
import { getNetworkIdByExchangeAddressOrThrow } from '@0x/contract-addresses';
import { ExchangeContractErrs, RevertReason, SignedOrder } from '@0x/types';
import { BigNumber, providerUtils } from '@0x/utils';
import { SupportedProvider, ZeroExProvider } from 'ethereum-types';
import * as _ from 'lodash';
import { AbstractOrderFilledCancelledFetcher } from './abstract/abstract_order_filled_cancelled_fetcher';
import { AssetBalanceAndProxyAllowanceFetcher } from './asset_balance_and_proxy_allowance_fetcher';
import { assetDataUtils } from './asset_data_utils';
import { constants } from './constants';
import { ExchangeTransferSimulator } from './exchange_transfer_simulator';
import { orderCalculationUtils } from './order_calculation_utils';
import { orderHashUtils } from './order_hash';
import { OrderStateUtils } from './order_state_utils';
import { validateOrderFillableOptsSchema } from './schemas/validate_order_fillable_opts_schema';
import { signatureUtils } from './signature_utils';
import { TradeSide, TransferType, TypedDataError } from './types';
import { BalanceAndProxyAllowanceLazyStore } from './store/balance_and_proxy_allowance_lazy_store';
import { TradeSide, TransferType, TypedDataError, ValidateOrderFillableOpts } from './types';
import { utils } from './utils';
/**
@@ -171,6 +179,74 @@ export class OrderValidationUtils {
const provider = providerUtils.standardizeOrThrow(supportedProvider);
this._provider = provider;
}
// TODO(xianny): remove this method once the smart contracts have been refactored
// to return helpful revert reasons instead of ORDER_UNFILLABLE. Instruct devs
// to make "calls" to validate order fillability + getOrderInfo for fillable amount.
// This method recreates functionality from ExchangeWrapper (@0x/contract-wrappers < 11.0.0)
// to make migrating easier in the interim.
/**
* Validate if the supplied order is fillable, and throw if it isn't
* @param provider The same provider used to interact with contracts
* @param signedOrder SignedOrder of interest
* @param opts ValidateOrderFillableOpts options (e.g expectedFillTakerTokenAmount.
* If it isn't supplied, we check if the order is fillable for the remaining amount.
* To check if the order is fillable for a non-zero amount, set `validateRemainingOrderAmountIsFillable` to false.)
*/
public async simpleValidateOrderFillableOrThrowAsync(
provider: SupportedProvider,
signedOrder: SignedOrder,
opts: ValidateOrderFillableOpts = {},
): Promise<void> {
assert.doesConformToSchema('opts', opts, validateOrderFillableOptsSchema);
const exchangeAddress = signedOrder.exchangeAddress;
const networkId = getNetworkIdByExchangeAddressOrThrow(exchangeAddress);
const { zrxToken, devUtils } = getContractAddressesForNetworkOrThrow(networkId);
const exchangeContract = new ExchangeContract(exchangeAddress, provider);
const balanceAllowanceFetcher = new AssetBalanceAndProxyAllowanceFetcher(
new DevUtilsContract(devUtils, provider),
);
const balanceAllowanceStore = new BalanceAndProxyAllowanceLazyStore(balanceAllowanceFetcher);
const exchangeTradeSimulator = new ExchangeTransferSimulator(balanceAllowanceStore);
// Define fillable taker asset amount
let fillableTakerAssetAmount;
const shouldValidateRemainingOrderAmountIsFillable =
opts.validateRemainingOrderAmountIsFillable === undefined
? true
: opts.validateRemainingOrderAmountIsFillable;
if (opts.expectedFillTakerTokenAmount) {
// If the caller has specified a taker fill amount, we use this for all validation
fillableTakerAssetAmount = opts.expectedFillTakerTokenAmount;
} else if (shouldValidateRemainingOrderAmountIsFillable) {
// Default behaviour is to validate the amount left on the order.
const filledTakerTokenAmount = await exchangeContract.filled.callAsync(
orderHashUtils.getOrderHashHex(signedOrder),
);
fillableTakerAssetAmount = signedOrder.takerAssetAmount.minus(filledTakerTokenAmount);
} else {
const orderStateUtils = new OrderStateUtils(balanceAllowanceStore, this._orderFilledCancelledFetcher);
// Calculate the taker amount fillable given the maker balance and allowance
const orderRelevantState = await orderStateUtils.getOpenOrderRelevantStateAsync(signedOrder);
fillableTakerAssetAmount = orderRelevantState.remainingFillableTakerAssetAmount;
}
await this.validateOrderFillableOrThrowAsync(
exchangeTradeSimulator,
signedOrder,
assetDataUtils.encodeERC20AssetData(zrxToken),
fillableTakerAssetAmount,
);
const makerTransferAmount = orderCalculationUtils.getMakerFillAmount(signedOrder, fillableTakerAssetAmount);
await OrderValidationUtils.validateMakerTransferThrowIfInvalidAsync(
networkId,
provider,
signedOrder,
makerTransferAmount,
opts.simulationTakerAddress,
);
}
// TODO(fabio): remove this method once the smart contracts have been refactored
// to return helpful revert reasons instead of ORDER_UNFILLABLE. Instruct devs
// to make "calls" to validate order fillability + getOrderInfo for fillable amount.

View File

@@ -0,0 +1,7 @@
export const validateOrderFillableOptsSchema = {
id: '/ValidateOrderFillableOpts',
properties: {
expectedFillTakerTokenAmount: { $ref: '/wholeNumberSchema' },
},
type: 'object',
};

View File

@@ -25,6 +25,12 @@ export interface CreateOrderOpts {
expirationTimeSeconds?: BigNumber;
}
export interface ValidateOrderFillableOpts {
expectedFillTakerTokenAmount?: BigNumber;
validateRemainingOrderAmountIsFillable?: boolean;
simulationTakerAddress?: string;
}
/**
* remainingFillableMakerAssetAmount: An array of BigNumbers corresponding to the `orders` parameter.
* You can use `OrderStateUtils` `@0x/order-utils` to perform blockchain lookups for these values.

View File

@@ -42,6 +42,7 @@ describe('ExchangeTransferSimulator', async () => {
from: devConstants.TESTRPC_FIRST_ADDRESS,
};
await blockchainLifecycle.startAsync();
const erc20Proxy = await ERC20ProxyContract.deployFrom0xArtifactAsync(
artifacts.ERC20Proxy,
provider,
@@ -74,6 +75,9 @@ describe('ExchangeTransferSimulator', async () => {
afterEach(async () => {
await blockchainLifecycle.revertAsync();
});
after(async () => {
await blockchainLifecycle.revertAsync();
});
describe('#transferFromAsync', function(): void {
// HACK: For some reason these tests need a slightly longer timeout
const mochaTestTimeoutMs = 3000;

View File

@@ -1,13 +1,23 @@
import { ContractAddresses, DummyERC20TokenContract } from '@0x/abi-gen-wrappers';
import { BlockchainLifecycle, devConstants, tokenUtils } from '@0x/dev-utils';
import { ExchangeContractErrs, RevertReason } from '@0x/types';
import { BigNumber } from '@0x/utils';
import * as chai from 'chai';
import 'mocha';
import { runMigrationsOnceAsync } from '@0x/migrations';
import { AbstractOrderFilledCancelledFetcher, assetDataUtils, signatureUtils, SignedOrder } from '../src';
import { OrderValidationUtils } from '../src/order_validation_utils';
import { UntransferrableDummyERC20Token } from './artifacts/UntransferrableDummyERC20Token';
import { chaiSetup } from './utils/chai_setup';
import { testOrderFactory } from './utils/test_order_factory';
import { provider, web3Wrapper } from './utils/web3_wrapper';
chaiSetup.configure();
const expect = chai.expect;
const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
describe('OrderValidationUtils', () => {
describe('#isRoundingError', () => {
@@ -67,4 +77,174 @@ describe('OrderValidationUtils', () => {
expect(isRoundingError).to.be.false();
});
});
describe('#validateOrderFillableOrThrowAsync', () => {
let contractAddresses: ContractAddresses;
let orderValidationUtils: OrderValidationUtils;
let makerAddress: string;
let takerAddress: string;
let ownerAddress: string;
let signedOrder: SignedOrder;
let makerTokenContract: DummyERC20TokenContract;
let takerTokenContract: DummyERC20TokenContract;
const txDefaults = {
gas: devConstants.GAS_LIMIT,
from: devConstants.TESTRPC_FIRST_ADDRESS,
};
before(async () => {
contractAddresses = await runMigrationsOnceAsync(provider, txDefaults);
await blockchainLifecycle.startAsync();
const [makerTokenAddress, takerTokenAddress] = tokenUtils.getDummyERC20TokenAddresses();
makerTokenContract = new DummyERC20TokenContract(makerTokenAddress, provider, txDefaults);
takerTokenContract = new DummyERC20TokenContract(takerTokenAddress, provider, txDefaults);
[ownerAddress, makerAddress, takerAddress] = await web3Wrapper.getAvailableAddressesAsync();
// create signed order
const [makerAssetData, takerAssetData] = [
assetDataUtils.encodeERC20AssetData(makerTokenContract.address),
assetDataUtils.encodeERC20AssetData(takerTokenContract.address),
];
const defaultOrderParams = {
exchangeAddress: contractAddresses.exchange,
makerAddress,
takerAddress,
makerAssetData,
takerAssetData,
};
const makerAssetAmount = new BigNumber(10);
const takerAssetAmount = new BigNumber(10000000000000000);
const [order] = testOrderFactory.generateTestSignedOrders(
{
...defaultOrderParams,
makerAssetAmount,
takerAssetAmount,
},
1,
);
signedOrder = await signatureUtils.ecSignOrderAsync(provider, order, makerAddress);
// instantiate OrderValidationUtils
const mockOrderFilledFetcher: AbstractOrderFilledCancelledFetcher = {
async getFilledTakerAmountAsync(_orderHash: string): Promise<BigNumber> {
return new BigNumber(0);
},
async isOrderCancelledAsync(_signedOrder: SignedOrder): Promise<boolean> {
return false;
},
getZRXAssetData(): string {
return assetDataUtils.encodeERC20AssetData(contractAddresses.zrxToken);
},
};
orderValidationUtils = new OrderValidationUtils(mockOrderFilledFetcher, provider);
});
after(async () => {
await blockchainLifecycle.revertAsync();
});
beforeEach(async () => {
await blockchainLifecycle.startAsync();
await makerTokenContract.setBalance.awaitTransactionSuccessAsync(
makerAddress,
signedOrder.makerAssetAmount,
);
await takerTokenContract.setBalance.awaitTransactionSuccessAsync(
takerAddress,
signedOrder.takerAssetAmount,
);
await makerTokenContract.approve.awaitTransactionSuccessAsync(
contractAddresses.erc20Proxy,
signedOrder.makerAssetAmount,
{ from: makerAddress },
);
await takerTokenContract.approve.awaitTransactionSuccessAsync(
contractAddresses.erc20Proxy,
signedOrder.takerAssetAmount,
{ from: takerAddress },
);
});
afterEach(async () => {
await blockchainLifecycle.revertAsync();
});
it('should throw if signature is invalid', async () => {
const signedOrderWithInvalidSignature = {
...signedOrder,
signature:
'0x1b61a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc3340349190569279751135161d22529dc25add4f6069af05be04cacbda2ace225403',
};
return expect(
orderValidationUtils.simpleValidateOrderFillableOrThrowAsync(provider, signedOrderWithInvalidSignature),
).to.be.rejectedWith(RevertReason.InvalidOrderSignature);
});
it('should validate the order with the current balances and allowances for the maker', async () => {
await orderValidationUtils.simpleValidateOrderFillableOrThrowAsync(provider, signedOrder, {
validateRemainingOrderAmountIsFillable: false,
});
});
it('should validate the order with remaining fillable amount for the order', async () => {
await orderValidationUtils.simpleValidateOrderFillableOrThrowAsync(provider, signedOrder);
});
it('should validate the order with specified amount', async () => {
await orderValidationUtils.simpleValidateOrderFillableOrThrowAsync(provider, signedOrder, {
expectedFillTakerTokenAmount: signedOrder.takerAssetAmount,
});
});
it('should throw if the amount is greater than the allowance/balance', async () => {
return expect(
orderValidationUtils.simpleValidateOrderFillableOrThrowAsync(provider, signedOrder, {
// tslint:disable-next-line:custom-no-magic-numbers
expectedFillTakerTokenAmount: new BigNumber(2).pow(256).minus(1),
}),
).to.be.rejectedWith(ExchangeContractErrs.InsufficientMakerAllowance);
});
it('should throw when the maker does not have enough balance for the remaining order amount', async () => {
await makerTokenContract.setBalance.awaitTransactionSuccessAsync(
makerAddress,
signedOrder.makerAssetAmount.minus(1),
);
return expect(
orderValidationUtils.simpleValidateOrderFillableOrThrowAsync(provider, signedOrder),
).to.be.rejectedWith(ExchangeContractErrs.InsufficientMakerBalance);
});
it('should validate the order when remaining order amount has some fillable amount', async () => {
await makerTokenContract.setBalance.awaitTransactionSuccessAsync(
makerAddress,
signedOrder.makerAssetAmount.minus(1),
);
await orderValidationUtils.simpleValidateOrderFillableOrThrowAsync(provider, signedOrder, {
validateRemainingOrderAmountIsFillable: false,
});
});
it('should throw when the ERC20 token has transfer restrictions', async () => {
const artifactDependencies = {};
const untransferrableToken = await DummyERC20TokenContract.deployFrom0xArtifactAsync(
UntransferrableDummyERC20Token,
provider,
{ from: ownerAddress },
artifactDependencies,
'UntransferrableToken',
'UTT',
new BigNumber(18),
// tslint:disable-next-line:custom-no-magic-numbers
new BigNumber(2).pow(20).minus(1),
);
const untransferrableMakerAssetData = assetDataUtils.encodeERC20AssetData(untransferrableToken.address);
const invalidOrder = {
...signedOrder,
makerAssetData: untransferrableMakerAssetData,
};
const invalidSignedOrder = await signatureUtils.ecSignOrderAsync(provider, invalidOrder, makerAddress);
await untransferrableToken.setBalance.awaitTransactionSuccessAsync(
makerAddress,
invalidSignedOrder.makerAssetAmount.plus(1),
);
await untransferrableToken.approve.awaitTransactionSuccessAsync(
contractAddresses.erc20Proxy,
invalidSignedOrder.makerAssetAmount.plus(1),
{ from: makerAddress },
);
return expect(
orderValidationUtils.simpleValidateOrderFillableOrThrowAsync(provider, invalidSignedOrder),
).to.be.rejectedWith(RevertReason.TransferFailed);
});
});
});

View File

@@ -1,6 +1,6 @@
import { web3Factory } from '@0x/dev-utils';
import { Web3ProviderEngine } from '@0x/subproviders';
import { Web3Wrapper } from '@0x/web3-wrapper';
import Web3ProviderEngine = require('web3-provider-engine');
const provider: Web3ProviderEngine = web3Factory.getRpcProvider({ shouldUseInProcessGanache: true });
const web3Wrapper = new Web3Wrapper(provider);

View File

@@ -1,4 +1,13 @@
[
{
"version": "4.3.0",
"changes": [
{
"note": "Add declaration for `ethereumjs-vm`",
"pr": 2108
}
]
},
{
"timestamp": 1567521715,
"version": "4.2.5",

View File

@@ -0,0 +1,334 @@
declare module 'ethereumjs-vm' {
import BN = require('bn.js');
type Common = any; // from ethereumjs-common
type Account = any; // from ethereumjs-account
type Blockchain = any; // from ethereumjs-blockchain
export default class VM {
opts: VmOpts;
stateManager: StateManager;
constructor(opts: VmOpts);
runCall(opts: RunCallOpts): Promise<EVMResult>;
}
interface VmOpts {
chain?: string;
hardfork?: string;
stateManager?: StateManager;
state?: any;
blockchain?: Blockchain;
activatePrecompiles?: boolean;
allowUnlimitedContractSize?: boolean;
common?: Common;
}
interface RunCallOpts {
block?: any;
gasPrice?: Buffer;
origin?: Buffer;
caller?: Buffer;
gasLimit?: Buffer;
to?: Buffer;
value?: Buffer;
data?: Buffer;
code?: Buffer;
depth?: number;
compiled?: boolean;
static?: boolean;
salt?: Buffer;
selfdestruct?: { [k: string]: boolean };
delegatecall?: boolean;
}
interface EVMResult {
gasUsed: BN;
createdAddress?: Buffer;
execResult: ExecResult;
}
interface ExecResult {
runState?: RunState;
exceptionError?: VmError;
gas?: BN;
gasUsed: BN;
returnValue: Buffer;
logs?: any[];
gasRefund?: BN;
selfdestruct?: { [k: string]: Buffer };
}
interface RunState {
programCounter: number;
opCode: number;
memory: Memory;
memoryWordCount: BN;
highestMemCost: BN;
stack: Stack;
code: Buffer;
validJumps: number[];
_common: Common;
stateManager: StateManager;
eei: EEI;
}
class Memory {
_store: number[];
constructor();
extend(offset: number, size: number): void;
write(offset: number, size: number, value: Buffer): void;
read(offset: number, size: number): Buffer;
}
class Stack {
_store: BN[];
constructor();
length(): number;
push(value: BN): void;
pop(): BN;
popN(num: number): BN[];
swap(position: number): void;
dup(position: number): void;
}
class StateManager {
_common: Common;
_trie: any;
_storageTries: any;
_cache: Cache;
_touched: Set<string>;
_touchedStack: Set<string>[];
_checkpointCount: number;
_originalStorageCache: Map<string, Map<string, Buffer>>;
constructor(opts: StateManagerOpts);
copy(): StateManager;
getAccount(address: Buffer, cb: any): void;
putAccount(address: Buffer, account: Account, cb: any): void;
putContractCode(address: Buffer, value: Buffer, cb: any): void;
getContractCode(address: Buffer, cb: any): void;
_lookupStorageTrie(address: Buffer, cb: any): void;
_getStorageTrie(address: Buffer, cb: any): void;
getContractStorage(address: Buffer, key: Buffer, cb: any): void;
getOriginalContractStorage(address: Buffer, key: Buffer, cb: any): void;
_modifyContractStorage(address: Buffer, modifyTrie: any, cb: any): void;
putContractStorage(address: Buffer, key: Buffer, value: Buffer, cb: any): void;
clearContractStorage(address: Buffer, cb: any): void;
checkpoint(cb: any): void;
commit(cb: any): void;
revert(cb: any): void;
getStateRoot(cb: any): void;
setStateRoot(stateRoot: Buffer, cb: any): void;
dumpStorage(address: Buffer, cb: any): void;
hasGenesisState(cb: any): void;
generateCanonicalGenesis(cb: any): void;
generateGenesis(initState: any, cb: any): void;
accountIsEmpty(address: Buffer, cb: any): void;
cleanupTouchedAccounts(cb: any): void;
_clearOriginalStorageCache(): void;
}
class Cache {
_cache: any;
_checkpoints: any[];
_trie: any;
constructor(trie: any);
put(key: Buffer, val: Account, fromTrie: boolean): void;
get(key: Buffer): Account;
lookup(key: Buffer): Account | undefined;
_lookupAccount(address: Buffer, cb: any): void;
getOrLoad(key: Buffer, cb: any): void;
warm(addresses: string[], cb: any): void;
flush(cb: any): void;
checkpoint(): void;
revert(): void;
commit(): void;
clear(): void;
del(key: Buffer): void;
_update(key: Buffer, val: Account, modified: boolean, deleted: boolean): void;
}
interface StateManagerOpts {
common?: Common;
trie?: any;
}
class EEI {
_env: Env;
_result: RunResult;
_state: PStateManager;
_evm: EVM;
_lastReturned: Buffer;
_common: Common;
_gasLeft: BN;
constructor(env: Env, state: PStateManager, evm: EVM, common: Common, gasLeft: BN);
useGas(amount: BN): void;
refundGas(amount: BN): void;
getAddress(): Buffer;
getExternalBalance(address: Buffer): Promise<BN>;
getSelfBalance(): BN;
getCaller(): BN;
getCallValue(): BN;
getCallData(): Buffer;
getCallDataSize(): BN;
getCodeSize(): BN;
getCode(): Buffer;
isStatic(): boolean;
getExternalCodeSize(address: BN): Promise<BN>;
getExternalCode(address: BN | Buffer): Promise<Buffer>;
getReturnDataSize(): BN;
getReturnData(): Buffer;
getTxGasPrice(): BN;
getTxOrigin(): BN;
getBlockNumber(): BN;
getBlockCoinbase(): BN;
getBlockTimestamp(): BN;
getBlockDifficulty(): BN;
getBlockGasLimit(): BN;
getChainId(): BN;
getBlockHash(num: BN): Promise<BN>;
storageStore(key: Buffer, value: Buffer): Promise<void>;
storageLoad(key: Buffer): Promise<Buffer>;
getGasLeft(): BN;
finish(returnData: Buffer): void;
revert(returnData: Buffer): void;
selfDestruct(toAddress: Buffer): Promise<void>;
_selfDestruct(toAddress: Buffer): Promise<void>;
log(data: Buffer, numberOfTopics: number, topics: Buffer[]): void;
call(gasLimit: BN, address: Buffer, value: BN, data: Buffer): Promise<BN>;
callCode(gasLimit: BN, address: Buffer, value: BN, data: Buffer): Promise<BN>;
callStatic(gasLimit: BN, address: Buffer, value: BN, data: Buffer): Promise<BN>;
callDelegate(gasLimit: BN, address: Buffer, value: BN, data: Buffer): Promise<BN>;
_baseCall(msg: Message): Promise<BN>;
create(gasLimit: BN, value: BN, data: Buffer, salt: Buffer | null): Promise<BN>;
create2(gasLimit: BN, value: BN, data: Buffer, salt: Buffer): Promise<BN>;
isAccountEmpty(address: Buffer): Promise<boolean>;
private _getReturnCode(results: EVMResult): any;
}
interface Env {
blockchain: Blockchain;
address: Buffer;
caller: Buffer;
callData: Buffer;
callValue: BN;
code: Buffer;
isStatic: boolean;
depth: number;
gasPrice: Buffer;
origin: Buffer;
block: any;
contract: Account;
}
interface RunResult {
logs: any;
returnValue?: Buffer;
gasRefund: BN;
selfdestruct: { [k: string]: Buffer };
}
export class PStateManager {
_wrapped: StateManager;
constructor(wrapped: StateManager);
copy(): PStateManager;
getAccount(addr: Buffer): Promise<Account>;
putAccount(addr: Buffer, account: Account): Promise<void>;
putContractCode(addr: Buffer, code: Buffer): Promise<void>;
getContractCode(addr: Buffer): Promise<Buffer>;
getContractStorage(addr: Buffer, key: Buffer): Promise<any>;
getOriginalContractStorage(addr: Buffer, key: Buffer): Promise<any>;
putContractStorage(addr: Buffer, key: Buffer, value: Buffer): Promise<void>;
clearContractStorage(addr: Buffer): Promise<void>;
checkpoint(): Promise<void>;
commit(): Promise<void>;
revert(): Promise<void>;
getStateRoot(): Promise<Buffer>;
setStateRoot(root: Buffer): Promise<void>;
dumpStorage(address: Buffer): Promise<StorageDump>;
hasGenesisState(): Promise<boolean>;
generateCanonicalGenesis(): Promise<void>;
generateGenesis(initState: any): Promise<void>;
accountIsEmpty(address: Buffer): Promise<boolean>;
cleanupTouchedAccounts(): Promise<void>;
}
interface StorageDump {
[key: string]: string;
}
class EVM {
_vm: any;
_state: PStateManager;
_tx: TxContext;
_block: any;
constructor(vm: any, txContext: TxContext, block: any);
executeMessage(message: Message): Promise<EVMResult>;
_executeCall(message: Message): Promise<EVMResult>;
_executeCreate(message: Message): Promise<EVMResult>;
runInterpreter(message: Message, opts: InterpreterOpts): Promise<ExecResult>;
getPrecompile(address: Buffer): PrecompileFunc;
runPrecompile(code: PrecompileFunc, data: Buffer, gasLimit: BN): ExecResult;
_loadCode(message: Message): Promise<void>;
_generateAddress(message: Message): Promise<Buffer>;
_reduceSenderBalance(account: Account, message: Message): Promise<void>;
_addToBalance(toAccount: Account, message: Message): Promise<void>;
_touchAccount(address: Buffer): Promise<void>;
}
class TxContext {
gasPrice: Buffer;
origin: Buffer;
constructor(gasPrice: Buffer, origin: Buffer);
}
class Message {
to: Buffer;
value: BN;
caller: Buffer;
gasLimit: BN;
data: Buffer;
depth: number;
code: Buffer | PrecompileFunc;
_codeAddress: Buffer;
isStatic: boolean;
isCompiled: boolean;
salt: Buffer;
selfdestruct: any;
delegatecall: boolean;
constructor(opts: any);
codeAddress(): Buffer;
}
interface InterpreterOpts {
pc?: number;
}
interface PrecompileFunc {
(opts: PrecompileInput): ExecResult;
}
interface PrecompileInput {
data: Buffer;
gasLimit: BN;
_common: Common;
}
class VmError {
error: ERROR;
errorType: string;
constructor(error: ERROR);
}
enum ERROR {
OUT_OF_GAS = 'out of gas',
STACK_UNDERFLOW = 'stack underflow',
STACK_OVERFLOW = 'stack overflow',
INVALID_JUMP = 'invalid JUMP',
INVALID_OPCODE = 'invalid opcode',
OUT_OF_RANGE = 'value out of range',
REVERT = 'revert',
STATIC_STATE_CHANGE = 'static state change',
INTERNAL_ERROR = 'internal error',
CREATE_COLLISION = 'create collision',
STOP = 'stop',
}
}

View File

@@ -4870,6 +4870,10 @@ copyfiles@^2.0.0:
through2 "^2.0.1"
yargs "^11.0.0"
core-js-pure@^3.0.1:
version "3.2.1"
resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.2.1.tgz#879a23699cff46175bfd2d09158b5c50645a3c45"
core-js@^1.0.0:
version "1.2.7"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-1.2.7.tgz#652294c14651db28fa93bd2d5ff2983a4f08c636"
@@ -6311,7 +6315,7 @@ ethereumjs-account@2.0.5:
rlp "^2.0.0"
safe-buffer "^5.1.1"
ethereumjs-account@3.0.0:
ethereumjs-account@3.0.0, ethereumjs-account@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/ethereumjs-account/-/ethereumjs-account-3.0.0.tgz#728f060c8e0c6e87f1e987f751d3da25422570a9"
dependencies:
@@ -6371,6 +6375,21 @@ ethereumjs-blockchain@^3.4.0:
safe-buffer "^5.1.2"
semaphore "^1.1.0"
ethereumjs-blockchain@^4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/ethereumjs-blockchain/-/ethereumjs-blockchain-4.0.1.tgz#db113dfed4fcc5197d223391f10adbc5a1b3536b"
dependencies:
async "^2.6.1"
ethashjs "~0.0.7"
ethereumjs-block "~2.2.0"
ethereumjs-common "^1.1.0"
ethereumjs-util "~6.1.0"
flow-stoplight "^1.0.0"
level-mem "^3.0.1"
lru-cache "^5.1.1"
rlp "^2.2.2"
semaphore "^1.1.0"
ethereumjs-blockstream@6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/ethereumjs-blockstream/-/ethereumjs-blockstream-6.0.0.tgz#79d726d1f358935eb65195e91d40344c31e87eff"
@@ -6395,6 +6414,10 @@ ethereumjs-common@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/ethereumjs-common/-/ethereumjs-common-1.1.0.tgz#5ec9086c314d619d8f05e79a0525829fcb0e93cb"
ethereumjs-common@^1.3.0:
version "1.3.1"
resolved "https://registry.yarnpkg.com/ethereumjs-common/-/ethereumjs-common-1.3.1.tgz#a5cffac41beb7ad393283b2e5aa71fadf8a9cc73"
ethereumjs-tx@1.3.7:
version "1.3.7"
resolved "https://registry.yarnpkg.com/ethereumjs-tx/-/ethereumjs-tx-1.3.7.tgz#88323a2d875b10549b8347e09f4862b546f3d89a"
@@ -6409,6 +6432,13 @@ ethereumjs-tx@^1.1.1, ethereumjs-tx@^1.2.0, ethereumjs-tx@^1.2.2, ethereumjs-tx@
ethereum-common "^0.0.18"
ethereumjs-util "^5.0.0"
ethereumjs-tx@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/ethereumjs-tx/-/ethereumjs-tx-2.1.0.tgz#36b9e6a46383b18941644ba5264e1b506115c002"
dependencies:
ethereumjs-common "^1.3.0"
ethereumjs-util "^6.0.0"
ethereumjs-util@5.2.0:
version "5.2.0"
resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-5.2.0.tgz#3e0c0d1741471acf1036052d048623dee54ad642"
@@ -6421,7 +6451,7 @@ ethereumjs-util@5.2.0:
safe-buffer "^5.1.1"
secp256k1 "^3.0.1"
ethereumjs-util@6.1.0, ethereumjs-util@^6.0.0:
ethereumjs-util@6.1.0, ethereumjs-util@^6.0.0, ethereumjs-util@^6.1.0, ethereumjs-util@~6.1.0:
version "6.1.0"
resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-6.1.0.tgz#e9c51e5549e8ebd757a339cc00f5380507e799c8"
dependencies:
@@ -6516,6 +6546,26 @@ ethereumjs-vm@^2.0.2, ethereumjs-vm@^2.1.0, ethereumjs-vm@^2.3.4:
rustbn.js "~0.1.1"
safe-buffer "^5.1.1"
ethereumjs-vm@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/ethereumjs-vm/-/ethereumjs-vm-4.0.0.tgz#cede265f4d3262782ef7b7faccdf6af1e49eb58d"
dependencies:
async "^2.1.2"
async-eventemitter "^0.2.2"
core-js-pure "^3.0.1"
ethereumjs-account "^3.0.0"
ethereumjs-block "~2.2.0"
ethereumjs-blockchain "^4.0.1"
ethereumjs-common "^1.3.0"
ethereumjs-tx "^2.1.0"
ethereumjs-util "^6.1.0"
fake-merkle-patricia-tree "^1.0.1"
functional-red-black-tree "^1.0.1"
merkle-patricia-tree "^2.3.2"
rustbn.js "~0.2.0"
safe-buffer "^5.1.1"
util.promisify "^1.0.0"
ethereumjs-wallet@0.6.3:
version "0.6.3"
resolved "https://registry.yarnpkg.com/ethereumjs-wallet/-/ethereumjs-wallet-0.6.3.tgz#b0eae6f327637c2aeb9ccb9047b982ac542e6ab1"
@@ -7985,22 +8035,22 @@ got@^6.7.1:
url-parse-lax "^1.0.0"
graceful-fs@^3.0.0:
version "3.0.11"
resolved "http://registry.yarnpkg.com/graceful-fs/-/graceful-fs-3.0.11.tgz#7613c778a1afea62f25c630a086d7f3acbbdd818"
version "3.0.12"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-3.0.12.tgz#0034947ce9ed695ec8ab0b854bc919e82b1ffaef"
dependencies:
natives "^1.1.0"
natives "^1.1.3"
graceful-fs@^4.0.0, graceful-fs@^4.1.10, graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9:
version "4.1.15"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.15.tgz#ffb703e1066e8a0eeaa4c8b80ba9253eeefbfb00"
graceful-fs@^4.2.0:
version "4.2.1"
resolved "http://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.1.tgz#1c1f0c364882c868f5bff6512146328336a11b1d"
version "4.2.2"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.2.tgz#6f0952605d0140c1cfdb138ed005775b92d67b02"
graceful-fs@~1.2.0:
version "1.2.3"
resolved "http://registry.yarnpkg.com/graceful-fs/-/graceful-fs-1.2.3.tgz#15a4806a57547cb2d2dbf27f42e89a8c3451b364"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-1.2.3.tgz#15a4806a57547cb2d2dbf27f42e89a8c3451b364"
"graceful-readlink@>= 1.0.0":
version "1.0.1"
@@ -8288,13 +8338,9 @@ heap@0.2.6:
version "0.2.6"
resolved "https://registry.yarnpkg.com/heap/-/heap-0.2.6.tgz#087e1f10b046932fc8594dd9e6d378afc9d1e5ac"
highlight.js@^9.15.8:
version "9.15.10"
resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-9.15.10.tgz#7b18ed75c90348c045eef9ed08ca1319a2219ad2"
highlight.js@^9.6.0:
version "9.13.1"
resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-9.13.1.tgz#054586d53a6863311168488a0f58d6c505ce641e"
highlight.js@^9.15.8, highlight.js@^9.6.0:
version "9.15.9"
resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-9.15.9.tgz#865257da1dbb4a58c4552d46c4b3854f77f0e6d5"
hmac-drbg@^1.0.0:
version "1.0.1"
@@ -11279,9 +11325,9 @@ nanomatch@^1.2.9:
snapdragon "^0.8.1"
to-regex "^3.0.1"
natives@^1.1.0:
natives@^1.1.3:
version "1.1.6"
resolved "http://registry.yarnpkg.com/natives/-/natives-1.1.6.tgz#a603b4a498ab77173612b9ea1acdec4d980f00bb"
resolved "https://registry.yarnpkg.com/natives/-/natives-1.1.6.tgz#a603b4a498ab77173612b9ea1acdec4d980f00bb"
natural-compare@^1.4.0:
version "1.4.0"
@@ -13902,7 +13948,7 @@ rlp@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/rlp/-/rlp-2.0.0.tgz#9db384ff4b89a8f61563d92395d8625b18f3afb0"
rlp@^2.2.1:
rlp@^2.2.1, rlp@^2.2.2:
version "2.2.3"
resolved "https://registry.yarnpkg.com/rlp/-/rlp-2.2.3.tgz#7f94aef86cec412df87d5ea1d8cb116a47d45f0e"
dependencies: