aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contract-wrappers
diff options
context:
space:
mode:
Diffstat (limited to 'packages/contract-wrappers')
-rw-r--r--packages/contract-wrappers/CHANGELOG.json9
-rw-r--r--packages/contract-wrappers/CHANGELOG.md4
-rw-r--r--packages/contract-wrappers/package.json21
-rw-r--r--packages/contract-wrappers/src/contract_wrappers/erc721_token_wrapper.ts20
-rw-r--r--packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts7
-rw-r--r--packages/contract-wrappers/src/index.ts15
-rw-r--r--packages/contract-wrappers/test/exchange_wrapper_test.ts8
7 files changed, 55 insertions, 29 deletions
diff --git a/packages/contract-wrappers/CHANGELOG.json b/packages/contract-wrappers/CHANGELOG.json
index 24f722f15..c6b5d07f7 100644
--- a/packages/contract-wrappers/CHANGELOG.json
+++ b/packages/contract-wrappers/CHANGELOG.json
@@ -13,6 +13,15 @@
"timestamp": 1531149657
},
{
+ "timestamp": 1531919263,
+ "version": "0.1.1",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
"timestamp": 1529397769,
"version": "0.0.5",
"changes": [
diff --git a/packages/contract-wrappers/CHANGELOG.md b/packages/contract-wrappers/CHANGELOG.md
index a2cc44f0d..822d0b486 100644
--- a/packages/contract-wrappers/CHANGELOG.md
+++ b/packages/contract-wrappers/CHANGELOG.md
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v0.1.1 - _July 18, 2018_
+
+ * Dependencies updated
+
## v0.1.0 - _July 9, 2018_
* Update Blockstream dep. to V5.0 and no longer force unsubscribe on blockstream error (which are not recoverable)
diff --git a/packages/contract-wrappers/package.json b/packages/contract-wrappers/package.json
index cc9ea21e8..c37030797 100644
--- a/packages/contract-wrappers/package.json
+++ b/packages/contract-wrappers/package.json
@@ -1,6 +1,6 @@
{
"name": "@0xproject/contract-wrappers",
- "version": "0.1.0",
+ "version": "0.1.1",
"description": "Smart TS wrappers for 0x smart contracts",
"keywords": [
"0xproject",
@@ -43,12 +43,12 @@
"node": ">=6.0.0"
},
"devDependencies": {
- "@0xproject/abi-gen": "^0.3.3",
- "@0xproject/dev-utils": "^0.4.5",
- "@0xproject/migrations": "^0.0.9",
+ "@0xproject/abi-gen": "^0.3.4",
+ "@0xproject/dev-utils": "^0.4.6",
+ "@0xproject/migrations": "^0.0.10",
"@0xproject/monorepo-scripts": "^0.2.2",
- "@0xproject/sol-compiler": "^0.5.3",
- "@0xproject/subproviders": "^0.10.5",
+ "@0xproject/sol-compiler": "^0.5.4",
+ "@0xproject/subproviders": "^0.10.6",
"@0xproject/tslint-config": "^0.4.21",
"@types/lodash": "4.14.104",
"@types/mocha": "^2.2.42",
@@ -69,16 +69,17 @@
"shx": "^0.2.2",
"sinon": "^4.0.0",
"source-map-support": "^0.5.0",
+ "web3-provider-engine": "14.0.6",
"tslint": "5.11.0",
"typescript": "2.7.1"
},
"dependencies": {
"@0xproject/assert": "^0.3.0",
- "@0xproject/base-contract": "^0.3.5",
+ "@0xproject/base-contract": "^0.3.6",
"@0xproject/order-utils": "^1.0.0",
- "@0xproject/typescript-typings": "^0.4.2",
- "@0xproject/utils": "^0.7.2",
- "@0xproject/web3-wrapper": "^0.7.2",
+ "@0xproject/typescript-typings": "^0.4.3",
+ "@0xproject/utils": "^0.7.3",
+ "@0xproject/web3-wrapper": "^0.7.3",
"@0xproject/fill-scenarios": "^1.0.0",
"@0xproject/json-schemas": "^1.0.0",
"@0xproject/types": "^1.0.0",
diff --git a/packages/contract-wrappers/src/contract_wrappers/erc721_token_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/erc721_token_wrapper.ts
index 3d24702b3..7c2b41c62 100644
--- a/packages/contract-wrappers/src/contract_wrappers/erc721_token_wrapper.ts
+++ b/packages/contract-wrappers/src/contract_wrappers/erc721_token_wrapper.ts
@@ -342,15 +342,17 @@ export class ERC721TokenWrapper extends ContractWrapper {
const normalizedSenderAddress = senderAddress.toLowerCase();
const tokenContract = await this._getTokenContractAsync(normalizedTokenAddress);
const ownerAddress = await this.getOwnerOfAsync(tokenAddress, tokenId);
- const isApprovedForAll = await this.isApprovedForAllAsync(
- normalizedTokenAddress,
- ownerAddress,
- normalizedSenderAddress,
- );
- if (!isApprovedForAll) {
- const approvedAddress = await this.getApprovedIfExistsAsync(normalizedTokenAddress, tokenId);
- if (approvedAddress !== senderAddress) {
- throw new Error(ContractWrappersError.ERC721NoApproval);
+ if (normalizedSenderAddress !== ownerAddress) {
+ const isApprovedForAll = await this.isApprovedForAllAsync(
+ normalizedTokenAddress,
+ ownerAddress,
+ normalizedSenderAddress,
+ );
+ if (!isApprovedForAll) {
+ const approvedAddress = await this.getApprovedIfExistsAsync(normalizedTokenAddress, tokenId);
+ if (approvedAddress !== normalizedSenderAddress) {
+ throw new Error(ContractWrappersError.ERC721NoApproval);
+ }
}
}
const txHash = await tokenContract.transferFrom.sendTransactionAsync(
diff --git a/packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts
index 0791c62f5..3e7619228 100644
--- a/packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts
+++ b/packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts
@@ -1,4 +1,5 @@
import { schemas } from '@0xproject/json-schemas';
+import { assetDataUtils } from '@0xproject/order-utils';
import { AssetProxyId, Order, SignedOrder } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
@@ -1071,9 +1072,9 @@ export class ExchangeWrapper extends ContractWrapper {
* Returns the ZRX asset data used by the exchange contract.
* @return ZRX asset data
*/
- public async getZRXAssetDataAsync(): Promise<string> {
- const exchangeInstance = await this._getExchangeContractAsync();
- const zrxAssetData = exchangeInstance.ZRX_ASSET_DATA.callAsync();
+ public getZRXAssetData(): string {
+ const zrxTokenAddress = this.getZRXTokenAddress();
+ const zrxAssetData = assetDataUtils.encodeERC20AssetData(zrxTokenAddress);
return zrxAssetData;
}
// tslint:disable:no-unused-variable
diff --git a/packages/contract-wrappers/src/index.ts b/packages/contract-wrappers/src/index.ts
index d8e597ed1..e5485d7a6 100644
--- a/packages/contract-wrappers/src/index.ts
+++ b/packages/contract-wrappers/src/index.ts
@@ -1,9 +1,9 @@
export { ContractWrappers } from './contract_wrappers';
export { ERC20TokenWrapper } from './contract_wrappers/erc20_token_wrapper';
+export { ERC721TokenWrapper } from './contract_wrappers/erc721_token_wrapper';
export { EtherTokenWrapper } from './contract_wrappers/ether_token_wrapper';
-export { ERC20ProxyWrapper } from './contract_wrappers/erc20_proxy_wrapper';
export { ExchangeWrapper } from './contract_wrappers/exchange_wrapper';
-export { ERC721TokenWrapper } from './contract_wrappers/erc721_token_wrapper';
+export { ERC20ProxyWrapper } from './contract_wrappers/erc20_proxy_wrapper';
export { ERC721ProxyWrapper } from './contract_wrappers/erc721_proxy_wrapper';
export {
@@ -26,7 +26,15 @@ export {
OrderInfo,
} from './types';
-export { Order, SignedOrder, ECSignature, OrderStateValid, OrderStateInvalid, OrderState } from '@0xproject/types';
+export {
+ Order,
+ SignedOrder,
+ ECSignature,
+ OrderStateValid,
+ OrderStateInvalid,
+ OrderState,
+ AssetProxyId,
+} from '@0xproject/types';
export {
BlockParamLiteral,
@@ -60,6 +68,7 @@ export {
ERC721TokenApprovalForAllEventArgs,
ERC721TokenTransferEventArgs,
ERC721TokenEvents,
+ ERC721TokenEventArgs,
} from './contract_wrappers/generated/erc721_token';
export {
diff --git a/packages/contract-wrappers/test/exchange_wrapper_test.ts b/packages/contract-wrappers/test/exchange_wrapper_test.ts
index f43938605..dca212f65 100644
--- a/packages/contract-wrappers/test/exchange_wrapper_test.ts
+++ b/packages/contract-wrappers/test/exchange_wrapper_test.ts
@@ -53,7 +53,6 @@ describe('ExchangeWrapper', () => {
await blockchainLifecycle.startAsync();
contractWrappers = new ContractWrappers(provider, config);
exchangeContractAddress = contractWrappers.exchange.getContractAddress();
- const erc20ProxyAddress = contractWrappers.erc20Proxy.getContractAddress();
userAddresses = await web3Wrapper.getAvailableAddressesAsync();
zrxTokenAddress = tokenUtils.getProtocolTokenAddress();
fillScenarios = new FillScenarios(
@@ -61,7 +60,8 @@ describe('ExchangeWrapper', () => {
userAddresses,
zrxTokenAddress,
exchangeContractAddress,
- erc20ProxyAddress,
+ contractWrappers.erc20Proxy.getContractAddress(),
+ contractWrappers.erc721Proxy.getContractAddress(),
);
[coinbase, makerAddress, takerAddress, feeRecipient, anotherMakerAddress] = userAddresses;
[makerTokenAddress, takerTokenAddress] = tokenUtils.getDummyERC20TokenAddresses();
@@ -264,8 +264,8 @@ describe('ExchangeWrapper', () => {
});
});
describe('#getZRXAssetData', () => {
- it('should get the asset data', async () => {
- const ZRX_ASSET_DATA = await contractWrappers.exchange.getZRXAssetDataAsync();
+ it('should get the asset data', () => {
+ const ZRX_ASSET_DATA = contractWrappers.exchange.getZRXAssetData();
const ASSET_DATA_HEX_LENGTH = 74;
expect(ZRX_ASSET_DATA).to.have.length(ASSET_DATA_HEX_LENGTH);
});