aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contract-wrappers/src
diff options
context:
space:
mode:
Diffstat (limited to 'packages/contract-wrappers/src')
-rw-r--r--packages/contract-wrappers/src/contract_wrappers/order_validator_wrapper.ts14
1 files changed, 13 insertions, 1 deletions
diff --git a/packages/contract-wrappers/src/contract_wrappers/order_validator_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/order_validator_wrapper.ts
index 854a93bbf..a1e02989d 100644
--- a/packages/contract-wrappers/src/contract_wrappers/order_validator_wrapper.ts
+++ b/packages/contract-wrappers/src/contract_wrappers/order_validator_wrapper.ts
@@ -1,11 +1,12 @@
import { schemas } from '@0xproject/json-schemas';
import { SignedOrder } from '@0xproject/types';
+import { BigNumber } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import { ContractAbi } from 'ethereum-types';
import * as _ from 'lodash';
import { artifacts } from '../artifacts';
-import { BalanceAndAllowance, OrderAndTraderInfo, OrdersAndTradersInfo, TraderInfo } from '../types';
+import { BalanceAndAllowance, OrderAndTraderInfo, TraderInfo } from '../types';
import { assert } from '../utils/assert';
import { ContractWrapper } from './contract_wrapper';
@@ -115,6 +116,17 @@ export class OrderValidatorWrapper extends ContractWrapper {
};
return result;
}
+ /**
+ * Get owner address of tokenId by calling `token.ownerOf(tokenId)`, but returns a null owner instead of reverting on an unowned token.
+ * @return Owner of tokenId or null address if unowned
+ */
+ public async getERC721TokenOwnerAsync(tokenAddress: string, tokenId: BigNumber): Promise<string | undefined> {
+ assert.isETHAddressHex('tokenAddress', tokenAddress);
+ assert.isBigNumber('tokenId', tokenId);
+ const OrderValidatorContractInstance = await this._getOrderValidatorContractAsync();
+ const result = await OrderValidatorContractInstance.getERC721TokenOwner.callAsync(tokenAddress, tokenId);
+ return result;
+ }
// HACK: We don't want this method to be visible to the other units within that package but not to the end user.
// TS doesn't give that possibility and therefore we make it private and access it over an any cast. Because of that tslint sees it as unused.
// tslint:disable-next-line:no-unused-variable