get balance of ERC721
ADD
examples/node/balanceofERC721.js
+const Matic = require('../../lib/index').default
+const config = require('./config')
+
+// Create object of Matic
+const matic = new Matic({
+ maticProvider: config.MATIC_PROVIDER,
+ parentProvider: config.PARENT_PROVIDER,
+ rootChainAddress: config.ROOTCHAIN_ADDRESS,
+ syncerUrl: config.SYNCER_URL,
+ watcherUrl: config.WATCHER_URL,
+ maticWethAddress: config.MATICWETH_ADDRESS,
+})
+matic.wallet = config.PRIVATE_KEY // prefix with `0x`
+
+const tokenAddress = config.ERC721_MATIC // token address on mainchain
+const from = config.FROM_ADDRESS // from address
+
+matic.balanceOfERC721(from, tokenAddress, {
+ parent: true,
+}).then(() => {
+ // action on Transaction success
+})

MODIFY
src/index.js
src/index.js
@@ -106,15 +106,6 @@ export default class Matic {
return balance
}
- async tokenOfOwnerByIndex(index, owner, token,options={}) {
- let web3Object = this._web3
- if (options.parent) {
- web3Object = this._parentWeb3
- }
- const tokenId = this._getERC721TokenContract(token,web3Object).methods.tokenOfOwnerByIndex(owner, index).call()
- return tokenId
- }
-
async depositEthers(user, options = {}) {
if (options && (!options.from || !user || !options.value)) {
throw new Error('Missing Parameters')

get balance of ERC721