diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-07-18 21:37:34 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-07-18 21:38:10 +0800 |
commit | c71781d9abf7f2654a51dbef95bd18200ea2bde1 (patch) | |
tree | bcaf7b858ba1d22d6f8c1afe0ff21aec28467598 /packages/contract-wrappers/src | |
parent | dad557164ea4ccc012243d43df013078a7c37eb6 (diff) | |
download | dexon-sol-tools-c71781d9abf7f2654a51dbef95bd18200ea2bde1.tar.gz 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.ts | 20 |
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( |