Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dot-abi-cli example: tokensOfOwnerByIndex Couldn't decode uint256 from ABI: 0x #8

Open
jacobrosenthal opened this issue May 21, 2018 · 1 comment

Comments

@jacobrosenthal
Copy link
Contributor

Ive poked at most of the function calls (that dont require gas) and they seem valid, but this one errors on me:

bash-3.2$ node cryptokitties-cli.js tokensOfOwnerByIndex 0xa6c366D97cb64708211f24310dFAd5363BC96a04 0
cryptokitties-cli.js tokensOfOwnerByIndex <owner> <index>

Returns the nth Kitty assigned to an address, with n specified by the  _index argument.

Positionals:
  owner, _owner                                                                                                                    [required]
  index, _index                                                                                                                    [required]

Options:
  --web3              web3 provider url                                                          [default: "https://mainnet.infura.io/remix"]
  --from              from address
  --gasPrice          gas price in wei to use for this transaction                                                    [default: "1000000010"]
  --gasLimit          maximum gas provided for this transaction                                                          [default: "4700000"]
  --value             The value transferred for the transaction in wei
  --contract-address  address to contract                                  [required] [default: "0x06012c8cf97BEaD5deAe237070F9587f8E7A266d"]
  --network-id        The network ID                                                                                           [default: "1"]
  --ledger            use a ledger                                                                                                  [boolean]
  --hd-path           hd-path (used for hardware wallets)                                                           [default: "44'/60'/0'/0"]
  --help              Show help                                                                                                     [boolean]
  --version           Show version number                                                                                           [boolean]
  --provider                                                                                                            [default: (provider)]

Error: Couldn't decode uint256 from ABI: 0x
    at SolidityTypeUInt.formatOutputUInt [as _outputFormatter] (/Users/jacobrosenthal/Downloads/dotta-license/dot-abi-cli/node_modules/web3-eth-abi/src/formatters.js:174:15)
    at SolidityTypeUInt.SolidityType.decode (/Users/jacobrosenthal/Downloads/dotta-license/dot-abi-cli/node_modules/web3-eth-abi/src/type.js:252:17)
    at /Users/jacobrosenthal/Downloads/dotta-license/dot-abi-cli/node_modules/web3-eth-abi/src/index.js:327:49
    at Array.forEach (<anonymous>)
    at ABICoder.decodeParameters (/Users/jacobrosenthal/Downloads/dotta-license/dot-abi-cli/node_modules/web3-eth-abi/src/index.js:326:13)
    at Contract._decodeMethodReturn (/Users/jacobrosenthal/Downloads/dotta-license/dot-abi-cli/node_modules/web3-eth-contract/src/index.js:459:22)
    at Method.outputFormatter (/Users/jacobrosenthal/Downloads/dotta-license/dot-abi-cli/node_modules/web3-eth-contract/src/index.js:811:46)
    at Method.formatOutput (/Users/jacobrosenthal/Downloads/dotta-license/dot-abi-cli/node_modules/web3-core-method/src/index.js:162:54)
    at sendTxCallback (/Users/jacobrosenthal/Downloads/dotta-license/dot-abi-cli/node_modules/web3-core-method/src/index.js:453:33)
    at /Users/jacobrosenthal/Downloads/dotta-license/dot-abi-cli/node_modules/web3-core-requestmanager/src/index.js:144:9
    at Web3ProviderEngine._inspectResponseForNewBlock (/Users/jacobrosenthal/Downloads/dotta-license/dot-abi-cli/examples/cryptokitties-cli/node_modules/truffle-hdwallet-provider/node_modules/web3-provider-engine/index.js:231:12)
    at /Users/jacobrosenthal/Downloads/dotta-license/dot-abi-cli/examples/cryptokitties-cli/node_modules/truffle-hdwallet-provider/node_modules/web3-provider-engine/index.js:131:14
    at /Users/jacobrosenthal/Downloads/dotta-license/dot-abi-cli/examples/cryptokitties-cli/node_modules/async/dist/async.js:473:16
    at replenish (/Users/jacobrosenthal/Downloads/dotta-license/dot-abi-cli/examples/cryptokitties-cli/node_modules/async/dist/async.js:993:25)
    at iterateeCallback (/Users/jacobrosenthal/Downloads/dotta-license/dot-abi-cli/examples/cryptokitties-cli/node_modules/async/dist/async.js:983:17)
    at /Users/jacobrosenthal/Downloads/dotta-license/dot-abi-cli/examples/cryptokitties-cli/node_modules/async/dist/async.js:958:16
    at async.eachSeries.resultObj.id (/Users/jacobrosenthal/Downloads/dotta-license/dot-abi-cli/examples/cryptokitties-cli/node_modules/truffle-hdwallet-provider/node_modules/web3-provider-engine/index.js:111:9)
    at /Users/jacobrosenthal/Downloads/dotta-license/dot-abi-cli/examples/cryptokitties-cli/node_modules/async/dist/async.js:3096:16
    at replenish (/Users/jacobrosenthal/Downloads/dotta-license/dot-abi-cli/examples/cryptokitties-cli/node_modules/async/dist/async.js:998:17)
    at iterateeCallback (/Users/jacobrosenthal/Downloads/dotta-license/dot-abi-cli/examples/cryptokitties-cli/node_modules/async/dist/async.js:983:17)
    at /Users/jacobrosenthal/Downloads/dotta-license/dot-abi-cli/examples/cryptokitties-cli/node_modules/async/dist/async.js:958:16
    at async.eachSeries.resultObj.id (/Users/jacobrosenthal/Downloads/dotta-license/dot-abi-cli/examples/cryptokitties-cli/node_modules/truffle-hdwallet-provider/node_modules/web3-provider-engine/index.js:111:9)
    at /Users/jacobrosenthal/Downloads/dotta-license/dot-abi-cli/examples/cryptokitties-cli/node_modules/async/dist/async.js:3096:16
    at replenish (/Users/jacobrosenthal/Downloads/dotta-license/dot-abi-cli/examples/cryptokitties-cli/node_modules/async/dist/async.js:998:17)
    at iterateeCallback (/Users/jacobrosenthal/Downloads/dotta-license/dot-abi-cli/examples/cryptokitties-cli/node_modules/async/dist/async.js:983:17)
    at /Users/jacobrosenthal/Downloads/dotta-license/dot-abi-cli/examples/cryptokitties-cli/node_modules/async/dist/async.js:958:16
    at async.eachSeries.resultObj.id (/Users/jacobrosenthal/Downloads/dotta-license/dot-abi-cli/examples/cryptokitties-cli/node_modules/truffle-hdwallet-provider/node_modules/web3-provider-engine/index.js:111:9)
    at /Users/jacobrosenthal/Downloads/dotta-license/dot-abi-cli/examples/cryptokitties-cli/node_modules/async/dist/async.js:3096:16
    at replenish (/Users/jacobrosenthal/Downloads/dotta-license/dot-abi-cli/examples/cryptokitties-cli/node_modules/async/dist/async.js:998:17)
    at /Users/jacobrosenthal/Downloads/dotta-license/dot-abi-cli/examples/cryptokitties-cli/node_modules/async/dist/async.js:1002:9
    at eachLimit$1 (/Users/jacobrosenthal/Downloads/dotta-license/dot-abi-cli/examples/cryptokitties-cli/node_modules/async/dist/async.js:3182:24)
    at Object.<anonymous> (/Users/jacobrosenthal/Downloads/dotta-license/dot-abi-cli/examples/cryptokitties-cli/node_modules/async/dist/async.js:1032:16)
    at end (/Users/jacobrosenthal/Downloads/dotta-license/dot-abi-cli/examples/cryptokitties-cli/node_modules/truffle-hdwallet-provider/node_modules/web3-provider-engine/index.js:106:11)
    at /Users/jacobrosenthal/Downloads/dotta-license/dot-abi-cli/examples/cryptokitties-cli/node_modules/truffle-hdwallet-provider/node_modules/web3-provider-engine/subproviders/web3.js:16:5
bash-3.2$ 
@jacobrosenthal
Copy link
Contributor Author

Apparently the costs associated with calls like that are a known problem, but this is not a timeout error
https://www.reddit.com/r/ethdev/comments/7jpecv/cryptokitties_tokensofowner_doesnt_return_anything/

Im not sure where if anywhere that function is defined in a public contract and it DOES look like a function not defined error. The function I can find in KittyCore is tokensOfOwner(address), so maybe there is a generator error of some kind here?

If I regen the combined abi with the etherscan copy of KittyCore.sol indeed that function dissapears from help

bash-3.2$ node cryptokitties-cli.js --help
Usage: cryptokitties-cli.js <command> [options]

Commands:
  cryptokitties-cli.js approve <to> <tokenId>                        Grant another address the right to transfer a specific Kitty via
                                                                     transferFrom(). This is the preferred flow for transfering NFTs to
                                                                     contracts.
  cryptokitties-cli.js approveSiring <addr> <sireId>                 Grants approval to another user to sire with one of your Kitties.
  cryptokitties-cli.js balanceOf <owner>                             Returns the number of Kitties owned by a specific address.
  cryptokitties-cli.js breedWithAuto <matronId> <sireId>             Breed a Kitty you own (as matron) with a sire that you own, or for which
                                                                     you  have previously been given Siring approval. Will either make your
                                                                     cat pregnant, or will  fail entirely. Requires a pre-payment of the fee
                                                                     given out to the first caller of giveBirth()
  cryptokitties-cli.js canBreedWith <matronId> <sireId>              Checks to see if two cats can breed together, including checks for
                                                                     ownership and siring approvals. Does NOT check that both cats are ready
                                                                     for  breeding (i.e. breedWith could still fail until the cooldowns are
                                                                     finished).  TODO: Shouldn't this check pregnancy and cooldowns?!?
  cryptokitties-cli.js getKitty <id>                                 Returns all the relevant information about a specific kitty.
  cryptokitties-cli.js giveBirth <matronId>                          Have a pregnant Kitty give birth!
  cryptokitties-cli.js isReadyToBreed <kittyId>                      Checks that a given kitten is able to breed (i.e. it is not pregnant or
                                                                     in the middle of a siring cooldown).
  cryptokitties-cli.js ownerOf <tokenId>                             Returns the address currently assigned ownership of a given Kitty.
  cryptokitties-cli.js supportsInterface <interfaceID>               Introspection interface as per ERC-165
                                                                     (https://github.com/ethereum/EIPs/issues/165).  Returns true for any
                                                                     standardized interfaces implemented by this contract. We implement
                                                                     ERC-165 (obviously!) and ERC-721.
  cryptokitties-cli.js tokenMetadata <tokenId> <preferredTransport>  Returns a URI pointing to a metadata package for this token conforming
                                                                     to  ERC-721 (https://github.com/ethereum/EIPs/issues/721)
  cryptokitties-cli.js tokensOfOwner <owner>                         Returns a list of all Kitty IDs assigned to an address.
  cryptokitties-cli.js totalSupply                                   Returns the total number of Kitties currently in existence.
  cryptokitties-cli.js transfer <to> <tokenId>                       Transfers a Kitty to another address. If transferring to a smart
                                                                     contract be VERY CAREFUL to ensure that it is aware of ERC-721 (or
                                                                     CryptoKitties specifically) or your Kitty may be lost forever.
                                                                     Seriously.
  cryptokitties-cli.js transferFrom <from> <to> <tokenId>            Transfer a Kitty owned by another address, for which the calling address
                                                                     has previously been granted transfer approval by the owner.
  cryptokitties-cli.js unpause                                       This is public rather than external so we can call super.unpause
                                                                     without using an expensive CALL.

Options:
  --web3              web3 provider url                                                          [default: "https://mainnet.infura.io/remix"]
  --from              from address
  --gasPrice          gas price in wei to use for this transaction                                                    [default: "1000000010"]
  --gasLimit          maximum gas provided for this transaction                                                          [default: "4700000"]
  --value             The value transferred for the transaction in wei
  --contract-address  address to contract                                  [required] [default: "0x06012c8cf97BEaD5deAe237070F9587f8E7A266d"]
  --network-id        The network ID                                                                                           [default: "1"]
  --ledger            use a ledger                                                                                                  [boolean]
  --hd-path           hd-path (used for hardware wallets)                                                           [default: "44'/60'/0'/0"]
  --help              Show help                                                                                                     [boolean]
  --version           Show version number                                                                                           [boolean]
  --provider                                                                                                            [default: (provider)]

And the new function 'runs' and returns empty, probably as a result of infura timing me out, but no more errors.

bash-3.2$ node cryptokitties-cli.js tokensOfOwner 0xa6c366D97cb64708211f24310dFAd5363BC96a04
[]

So perhaps you generated from an odd copy of the kitty contract?

jacobrosenthal added a commit to jacobrosenthal/dotta-license that referenced this issue May 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant