aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contract-wrappers/src
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-07-18 21:37:34 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-07-18 21:38:10 +0800
commitc71781d9abf7f2654a51dbef95bd18200ea2bde1 (patch)
treebcaf7b858ba1d22d6f8c1afe0ff21aec28467598 /packages/contract-wrappers/src
parentdad557164ea4ccc012243d43df013078a7c37eb6 (diff)
downloaddexon-sol-tools-c71781d9abf7f2654a51dbef95bd18200ea2bde1.tar
dexon-sol-tools-c71781d9abf7f2654a51dbef95bd18200ea2bde1.tar.gz
dexon-sol-tools-c71781d9abf7f2654a51dbef95bd18200ea2bde1.tar.bz2
dexon-sol-tools-c71781d9abf7f2654a51dbef95bd18200ea2bde1.tar.lz
dexon-sol-tools-c71781d9abf7f2654a51dbef95bd18200ea2bde1.tar.xz
dexon-sol-tools-c71781d9abf7f2654a51dbef95bd18200ea2bde1.tar.zst
dexon-sol-tools-c71781d9abf7f2654a51dbef95bd18200ea2bde1.zip
Merge
Diffstat (limited to 'packages/contract-wrappers/src')
-rw-r--r--packages/contract-wrappers/src/contract_wrappers/erc721_token_wrapper.ts20
1 files changed, 11 insertions, 9 deletions
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(