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

TokenUpdateNftsTransaction() returns TypeError #265

Closed
nadineloepfe opened this issue Sep 11, 2024 · 4 comments · Fixed by hashgraph/hedera-sdk-js#2613
Closed

TokenUpdateNftsTransaction() returns TypeError #265

nadineloepfe opened this issue Sep 11, 2024 · 4 comments · Fixed by hashgraph/hedera-sdk-js#2613
Labels
Bug A error that causes the feature to behave differently than what was expected based on design docs P1 High priority issue. Required to be completed in the assigned milestone. Regression Behavior that used to work in a released product or service that no longer works with a new release.

Comments

@nadineloepfe
Copy link

Describe the bug

I'm trying to run a TokenUpdateNftsTransaction() with WalletConnect and I'm running into this TypeError (see screenshot).
This only happens when using the signer/provider from WalletConnect – when testing this step with const client = Client.forTestnet().setOperator(operatorId, operatorKey) then it is successful in updating the metadata.
for ref - I've tried multiple versions of the syntax, all of them failing with the same error:

      const updateTransaction = new TokenUpdateNftsTransaction()
        .setTokenId(formattedTokenId)
        .setSerialNumbers([serialNumber])
        .setMetadata(new TextEncoder().encode(newMetadataUri))
        .freezeWith(hederaClient);
      
      const signedUpdateTx = await updateTransaction.sign(metadataKey);
      const txResult = await signedUpdateTx.executeWithSigner(signer);

as well as:

const updateTransaction = new TokenUpdateNftsTransaction()
      .setTokenId(tokenId) 
      .setSerialNumbers([serialNumber]) 
      .setMetadata(new TextEncoder().encode(newMetadataUri);) 

    await updateTransaction.freezeWithSigner(signer);
    const signedUpdateTx = await updateTransaction.sign(metadataKey);
    const txResult = await signedUpdateTx.executeWithSigner(signer);

it's always breaking at await signedUpdateTx.executeWithSigner(signer);
I am suspecting this may be an issue with WalletConnect.
Given this is a new transaction type it may be the wallet doesn’t support it yet.

To Reproduce Steps to reproduce the behavior:

  1. login with wallet connect
  2. specify inputs
  3. click update and check console

Example program to reproduce issue with one click (update-nft-metadata-e2e branch)
2. Example Program if pre-minted token shall be used (update-nft-metadata branch)
3. Gist

Expected behavior
Metadata updating successfully

Screenshots

Screenshot 2024-09-10 at 23 12 25

Desktop (please complete the following information):

  • OS: iOS
  • Browser Chrome
@itsbrandondev itsbrandondev added Bug A error that causes the feature to behave differently than what was expected based on design docs P1 High priority issue. Required to be completed in the assigned milestone. Regression Behavior that used to work in a released product or service that no longer works with a new release. labels Sep 13, 2024
@kantorcodes
Copy link
Contributor

@nadineloepfe

So the root of this issue was related to the Hedera SDK. Could you try with version [v2.53.0-beta.4](https://github.com/hashgraph/hedera-sdk-js/releases/tag/v2.53.0-beta.4) and see if that resolves your issue?

@nadineloepfe
Copy link
Author

it unfortunately doesn't, @kantorcodes

output:

{
  "txError": {},
  "queryError": {
    "name": "Error",
    "message": "(BUG) Query.fromBytes() not implemented for type getByKey",
    "stack": "Error: (BUG) Query.fromBytes() not implemented for type getByKey\n    at Query.fromBytes (http://localhost:5173/node_modules/.vite/deps/chunk-5ICC4Y3K.js?v=c21a5bb8:67495:13)\n    at DAppSigner._tryExecuteQueryRequest (http://localhost:5173/node_modules/.vite/deps/@hashgraph_hedera-wallet-connect.js?v=157578fc:32323:27)\n    at DAppSigner.call (http://localhost:5173/node_modules/.vite/deps/@hashgraph_hedera-wallet-connect.js?v=157578fc:32342:36)\n    at async metadataUpdate (http://localhost:5173/main.js:226:22)\n    at async HTMLButtonElement.handleRunTest (http://localhost:5173/main.js:247:5)"
  }
}

@kantorcodes
Copy link
Contributor

it unfortunately doesn't, @kantorcodes

output:

{
  "txError": {},
  "queryError": {
    "name": "Error",
    "message": "(BUG) Query.fromBytes() not implemented for type getByKey",
    "stack": "Error: (BUG) Query.fromBytes() not implemented for type getByKey\n    at Query.fromBytes (http://localhost:5173/node_modules/.vite/deps/chunk-5ICC4Y3K.js?v=c21a5bb8:67495:13)\n    at DAppSigner._tryExecuteQueryRequest (http://localhost:5173/node_modules/.vite/deps/@hashgraph_hedera-wallet-connect.js?v=157578fc:32323:27)\n    at DAppSigner.call (http://localhost:5173/node_modules/.vite/deps/@hashgraph_hedera-wallet-connect.js?v=157578fc:32342:36)\n    at async metadataUpdate (http://localhost:5173/main.js:226:22)\n    at async HTMLButtonElement.handleRunTest (http://localhost:5173/main.js:247:5)"
  }
}

Hi!

Could you confirm the full code snippet on your end as well as the packages you're using? You'll need the latest hashgraph SDK and canary release

   "@hashgraph/hedera-wallet-connect": "1.3.8-canary.25ba652.0",

@kantorcodes
Copy link
Contributor

Hi @nadineloepfe I've added an example in this PR to demonstrate the TokenUpdateTransaction is working:

https://github.com/hashgraph/hedera-wallet-connect/pull/362/files

Please take a look and see if you are able to get this working. In the meantime, I am closing this out. Feel free to reopen if you are still having issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A error that causes the feature to behave differently than what was expected based on design docs P1 High priority issue. Required to be completed in the assigned milestone. Regression Behavior that used to work in a released product or service that no longer works with a new release.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants