aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorBrandon Millman <brandon.millman@gmail.com>2018-08-28 04:02:49 +0800
committerBrandon Millman <brandon.millman@gmail.com>2018-08-28 04:21:14 +0800
commitb0f210dea9b89fddb877dcdb0fd21a5ec08cc0d5 (patch)
tree4a75e299dc56c0b7e3f7cc47ccba5e47e5fdc8db /packages
parentf7469080f929d2364b1621e92857c76cb008bec9 (diff)
downloaddexon-sol-tools-b0f210dea9b89fddb877dcdb0fd21a5ec08cc0d5.tar
dexon-sol-tools-b0f210dea9b89fddb877dcdb0fd21a5ec08cc0d5.tar.gz
dexon-sol-tools-b0f210dea9b89fddb877dcdb0fd21a5ec08cc0d5.tar.bz2
dexon-sol-tools-b0f210dea9b89fddb877dcdb0fd21a5ec08cc0d5.tar.lz
dexon-sol-tools-b0f210dea9b89fddb877dcdb0fd21a5ec08cc0d5.tar.xz
dexon-sol-tools-b0f210dea9b89fddb877dcdb0fd21a5ec08cc0d5.tar.zst
dexon-sol-tools-b0f210dea9b89fddb877dcdb0fd21a5ec08cc0d5.zip
Add getERC721Owner to wrapper
Diffstat (limited to 'packages')
-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